graphology-bipartite
v0.0.3
Published
Bipartite graph functions for graphology.
Downloads
21
Maintainers
Readme
Graphology Bipartite
Functions related to bipartite graphs and to be used with graphology
.
Installation
npm install graphology-bipartite
Usage
isBypartiteBy
Returns whether the given graph is bipartite according to the given partition scheme.
import {isBypartiteBy} from 'graphology-bipartite';
// Alternatively, to load only the relevant code:
import isBypartiteBy from 'graphology-bipartite/is-bipartite-by';
// Wrt some node attribute:
isBipartiteBy(graph, 'category');
// Using some getter function:
isBipartiteBy(graph, (node, attr) => externalIndex[node].category);
Arguments
- graph Graph: target graph.
- getNodePartition string|function: node attribute name or getter function taking a node entry (node, attributes) and returning this node's partition.