![Build Status](https://travis-ci.org/graphology/graphology-metrics.svg)
Graphology metrics
Miscellaneous metrics to be used with graphology
.
Installation
npm install graphology-metrics
Usage
Modularity
Compute the modularity, given the graph and a partitioning
import {modularity} from 'graphology-metrics';
import modularity from 'graphology-metrics/modularity';
const Q = modularity(graph);
const Q = modularity(graph, {
communities: {'1': 0, '2': 0, '3': 1, '4': 1, '5': 1}
});
Arguments
- graph Graph: target graph.
- options ?object: options:
- communities ?object: object mapping nodes to their respective communities.
- attributes ?object: attributes' names:
- community ?string [
community
]: name of the nodes' community attribute in case we need to read them from the graph itself. - weight ?string [
weight
]: name of the edges' weight attribute.