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.17.0 to 1.18.0

centrality/closeness.d.ts

1

centrality/index.d.ts
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');

2

package.json
{
"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 @@

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