Louvain community detection for graphology.
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.gitignore
.travis.yml
LICENSE.txt
README.md
index.js
package.json

README.md

Build Status

Graphology Communities Louvain

Louvain method for community detection to be used with graphology.

Installation

npm install graphology-communities-louvain

Usage

Detect the communities of the given graph using Louvain's method.

import louvain from 'graphology-communities-louvain';

// To retrieve the partition
const communities = louvain(graph);

// To directly assign communities as a node attribute
louvain.assign(graph);

// If you need to customize attributes' names
louvain.assign(graph, {
  attributes: {
    weight: 'myCustomWeight',
    community: 'myCustomCommunity'
  }
});

Arguments

  • graph Graph: graph to which you want to get the best partitioning.
  • options ?object: options:
    • attributes ?object: attributes' names:
      • weight ?string [weight]: name of the edges' weight attribute.
      • community ?string [community]: name of the node attribute holding community information