Community detection algorithm based on graph modularity metric. It is code adaptation of Gephi Modularity.java to javascript.
var dot = require('ngraph.fromdot')
, Modularity = require('../Modularity')
, centrality = require('ngraph.centrality')
;
var g = dot('digraph G { a -> b; b -> c; c -> a; a -> d; d -> e; e -> f; f -> d; f -> g; g -> e; }');
var modularity = new Modularity;
var communities = modularity.execute(g);
console.dir(communities);
With npm:
npm install ngraph.modularity --save
MIT