New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.15.0 to 1.16.0

centrality/hits.d.ts

2

centrality/index.d.ts
export {default as betweenness} from './betweenness';
export {default as degree} from './degree';
export {default as hits} from './hits';
export {default as pagerank} from './pagerank';

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

exports.degree = require('./degree.js');
exports.hits = require('./hits.js');
exports.pagerank = require('./pagerank.js');

2

package.json
{
"name": "graphology-metrics",
"version": "1.15.0",
"version": "1.16.0",
"description": "Miscellaneous graph metrics for graphology.",

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

@@ -26,2 +26,4 @@ # Graphology metrics

- [Degree centrality](#degree-centrality)
- [HITS](#hits)
- [Pagerank](#pagerank)
- [Degree](#degree)

@@ -247,2 +249,61 @@ - [Eccentricity](#eccentricity)

### HITS
Computes the hub/authority metrics for each node using the HITS algorithm.
```js
import hits from 'graphology-metrics/centrality/hits';
// To compute and return the result as 'hubs' & 'authorities':
const {hubs, authorities} = hits(graph);
// To directly map the result to nodes' attributes:
hits.assign(graph);
// Note that you can also pass options to customize the algorithm:
const {hubs, authorities} = hits(graph, {normalize: false});
```
_Arguments_
- **graph** _Graph_: target graph.
- **options** _?object_: options:
- **attributes** _?object_: attributes' names:
- **weight** _?string_ [`weight`]: name of the edges' weight attribute.
- **hub** _?string_ [`hub`]: name of the node attribute holding hub information.
- **authority** _?string_ [`authority`]: name of the node attribute holding authority information.
- **maxIterations** _?number_ [`100`]: maximum number of iterations to perform.
- **normalize** _?boolean_ [`true`]: should the result be normalized by the sum of values.
- **tolerance** _?number_ [`1.e-8`]: convergence error tolerance.
### Pagerank
Computes the pagerank metrics for each node.
```js
import pagerank from 'graphology-metrics/centrality/pagerank';
// To compute pagerank and return the score per node:
const scores = pagerank(graph);
// To directly map the result to nodes' attributes:
pagerank.assign(graph);
// Note that you can also pass options to customize the algorithm:
const p = pagerank(graph, {alpha: 0.9, weighted: false});
```
_Arguments_
- **graph** _Graph_: target graph.
- **options** _?object_: options:
- **attributes** _?object_: attributes' names:
- **pagerank** _?string_ [`pagerank`]: name of the node attribute that will be assigned the pagerank score.
- **weight** _?string_ [`weight`]: name of the edges' weight attribute.
- **alpha** _?number_ [`0.85`]: damping parameter of the algorithm.
- **maxIterations** _?number_ [`100`]: maximum number of iterations to perform.
- **tolerance** _?number_ [`1.e-6`]: convergence error tolerance.
- **weighted** _?boolean_ [`false`]: whether to use available weights or not.
### Weighted degree

@@ -249,0 +310,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