graphology-metrics
Advanced tools
Comparing version 1.17.0 to 1.18.0
export {default as betweenness} from './betweenness'; | ||
export {default as closeness} from './closeness'; | ||
export {default as degree} from './degree'; | ||
@@ -3,0 +4,0 @@ export {default as eigenvector} from './eigenvector'; |
@@ -8,2 +8,3 @@ /** | ||
exports.betweenness = require('./betweenness.js'); | ||
exports.closeness = require('./closeness.js'); | ||
exports.degree = require('./degree.js'); | ||
@@ -10,0 +11,0 @@ exports.eigenvector = require('./eigenvector.js'); |
{ | ||
"name": "graphology-metrics", | ||
"version": "1.17.0", | ||
"version": "1.18.0", | ||
"description": "Miscellaneous graph metrics for graphology.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -25,2 +25,3 @@ # Graphology metrics | ||
- [Betweenness centrality](#betweenness-centrality) | ||
- [Closeness centrality](#closeness-centrality) | ||
- [Degree centrality](#degree-centrality) | ||
@@ -220,2 +221,27 @@ - [Eigenvector centrality](#eigenvector-centrality) | ||
### Closeness centrality | ||
Computes the closeness centrality of a graph's nodes. | ||
```js | ||
import closenessCentrality from 'graphology-metrics/centrality/closeness'; | ||
// To compute the eigenvector centrality and return the score per node: | ||
const scores = closenessCentrality(graph); | ||
// To directly map the result to nodes' attributes: | ||
closenessCentrality.assign(graph); | ||
// Note that you can also pass options to customize the algorithm: | ||
const p = closenessCentrality(graph, {wassermanFaust: true}); | ||
``` | ||
_Arguments_ | ||
- **graph** _Graph_: target graph. | ||
- **options** _?object_: options: | ||
- **attributes** _?object_: attributes' names: | ||
- **centrality** _?string_ [`eigenvectorCentrality`]: name of the node attribute that will be assigned the eigenvector centrality. | ||
- **wassermanFaust** _?boolean_ [`false`]: whether to use Wasserman & Faust's normalization scheme. | ||
#### Degree centrality | ||
@@ -222,0 +248,0 @@ |
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
95746
43
2331
582