Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graphology-metrics

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphology-metrics - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

centrality/degree.js

1

index.js

@@ -9,1 +9,2 @@ /**

exports.modularity = require('./modularity.js');
exports.centrality = require('./centrality');

18

package.json
{
"name": "graphology-metrics",
"version": "1.2.0",
"version": "1.3.0",
"description": "Miscellaneous graph metrics for graphology.",
"main": "index.js",
"files": [
"density.js",
"index.js",
"modularity.js"
"centrality",
"*.js"
],
"scripts": {
"lint": "eslint *.js test/*.js",
"lint": "eslint *.js centrality/*.js test/*.js",
"prepublish": "npm run lint && npm test",

@@ -21,2 +20,3 @@ "test": "mocha test"

"keywords": [
"centrality",
"density",

@@ -44,7 +44,7 @@ "graph",

"devDependencies": {
"@yomguithereal/eslint-config": "^3.0.0",
"@yomguithereal/eslint-config": "^4.0.0",
"chai": "^4.0.0",
"eslint": "^3.5.0",
"graphology": "^0.10.0",
"mocha": "^3.0.2"
"eslint": "^4.10.0",
"graphology": "^0.11.0",
"mocha": "^4.0.1"
},

@@ -51,0 +51,0 @@ "eslintConfig": {

@@ -15,5 +15,12 @@ [![Build Status](https://travis-ci.org/graphology/graphology-metrics.svg)](https://travis-ci.org/graphology/graphology-metrics)

*Graph metrics*
* [Density](#density)
* [Modularity](#modularity)
*Node metrics*
* [Centrality](#centrality)
- [Degree centrality](#degree-centrality)
### Density

@@ -84,1 +91,31 @@

### Centrality
#### Degree centrality
Computes the degree centrality for every node.
```js
import degreeCentrality from 'graphology-metrics/centrality/degree';
// Or to load more specific functions:
import {
degreeCentrality,
inDegreeCentrality,
outDegreeCentrality
} from 'graphology-metrics/centrality/degree';
// To get centralities for every node:
const centralities = degreeCentrality(graph);
// To directly map the result onto nodes' attributes (`degreeCentrality`):
degreeCentrality.assign(graph);
// To directly map the result onto a custom attribute:
degreeCentrality.assign(graph, {attribute: 'myCentrality'});
```
*Arguments*
* **graph** *Graph*: target graph.
* **options** *?object*: options:
* **attribute** *?string*: name of the centrality attribute.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc