ngraph.louvain
Given a graph instance detects clusters using the Louvain Method. Demo
usage
// Let's say you have an ngraph instance:var graph = ;// To detect clusters:var detectClusters = ;var clusters = ;// now you can iterate over each node and get it's community (aka class):graph;
Note: Louvain method is hierarchical. I.e. you should be able to get coarser
graphs based on detected communities. By default ngraph.louvain
does not implement hierarchies, yet you can easily achieve it by following:
var coarsen = ;var detectClusters = ;var clusters = ;whileclustersgraph = ;clusters = ;// this will give you next level in the hierarchy
install
npm install ngraph.louvain
see also
- https://github.com/anvaka/ngraph.graph - graph structure
- https://github.com/anvaka/ngraph.cw - label-propagation based community detection
- https://github.com/anvaka/ngraph.coarsen - Graph coarser
license
MIT