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.4.0 to 1.5.0

centrality/betweenness.js

10

centrality/degree.js

@@ -15,7 +15,7 @@ /**

*
* @param {boolean} assign - Whether to assign the result to the nodes.
* @param {string} method - Method of the graph to get the degree.
* @param {Graph} graph - A graphology instance.
* @param {object} [options] - Options:
* @param {string} [attribute] - Name of the attribute to assign.
* @param {boolean} assign - Whether to assign the result to the nodes.
* @param {string} method - Method of the graph to get the degree.
* @param {Graph} graph - A graphology instance.
* @param {object} [options] - Options:
* @param {string} [attribute] - Name of the attribute to assign.
*/

@@ -22,0 +22,0 @@ function abstractDegreeCentrality(assign, method, graph, options) {

@@ -7,2 +7,3 @@ /**

*/
exports.betweenness = require('./betweenness.js');
exports.degree = require('./degree.js');
{
"name": "graphology-metrics",
"version": "1.4.0",
"version": "1.5.0",
"description": "Miscellaneous graph metrics for graphology.",

@@ -11,5 +11,5 @@ "main": "index.js",

"scripts": {
"lint": "eslint *.js centrality/*.js test/*.js",
"lint": "eslint **/*.js",
"prepublish": "npm run lint && npm test",
"test": "mocha test"
"test": "mocha --recursive test"
},

@@ -48,4 +48,5 @@ "repository": {

"eslint": "^4.18.2",
"graphology": "^0.11.1",
"mocha": "^4.1.0"
"graphology": "^0.11.2",
"graphology-generators": "^0.9.0",
"mocha": "^5.0.4"
},

@@ -56,5 +57,6 @@ "eslintConfig": {

"dependencies": {
"graphology-utils": "^1.1.1",
"graphology-shortest-path": "^1.0.1",
"graphology-utils": "^1.3.0",
"lodash": "^4.17.5"
}
}

@@ -24,2 +24,3 @@ [![Build Status](https://travis-ci.org/graphology/graphology-metrics.svg)](https://travis-ci.org/graphology/graphology-metrics)

* [Centrality](#centrality)
- [Betweenness centrality](#betweenness-centrality)
- [Degree centrality](#degree-centrality)

@@ -119,2 +120,32 @@

#### Betweenness centrality
Computes the betweenness centrality for every node.
```js
import betweennessCentrality from 'graphology-metrics/centrality/betweenness';
// To compute centrality for every node:
const centrality = betweennessCentrality(graph);
// To compute weighted betweenness centrality
const centrality = betweennessCentrality(graph, {weighted: true});
// To directly map the result onto nodes' attributes (`beetweennessCentrality`):
betweennessCentrality.assign(graph);
// To directly map the result onto a custom attribute:
betweennessCentrality.assign(graph, {attributes: 'myCentrality'});
```
*Arguments*
* **graph** *Graph*: target graph.
* **options** *?object*: options:
* **attributes** *?object*: Custom attribute names:
- **centrality** *?string* [`betweennessCentrality`]: Name of the centrality attribute to assign.
- **weight** *?string*: Name of the weight attribute.
* **normalized** *?boolean* [`true`]: should the result be normalized?
* **weighted** *?boolean* [`false`]: should we compute the weighted betweenness centrality?
#### Degree centrality

@@ -133,4 +164,4 @@

// To get centralities for every node:
const centralities = degreeCentrality(graph);
// To compute degree centrality for every node:
const centrality = degreeCentrality(graph);

@@ -137,0 +168,0 @@ // To directly map the result onto nodes' attributes (`degreeCentrality`):

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