Package Exports
- graphology-metrics
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (graphology-metrics) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Graphology metrics
Miscellaneous metrics to be used with graphology.
Installation
npm install graphology-metricsUsage
Modularity
Compute the modularity, given the graph and a partitioning
import {modularity} from 'graphology-metrics';
// Alternatively, to load only the relevant code:
import modularity from 'graphology-metrics/modularity';
// Simplest way
const Q = modularity(graph);
// If community mapping is external to the 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.
- community ?string [