graphology-metrics
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -9,1 +9,2 @@ /** | ||
exports.modularity = require('./modularity.js'); | ||
exports.centrality = require('./centrality'); |
{ | ||
"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. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15209
8
310
120