documentationfor yFiles for HTML 2.6

LouvainModularityClustering

Detects the communities in the specified input graph by applying the Louvain modularity method.

Inheritance Hierarchy
LouvainModularityClustering

Remarks

Louvain Modularity algorithm iteratively tries to construct communities by moving nodes from their current community to another until the modularity is locally optimized.

The implementation is based on the description in: "Fast unfolding of communities in large networks" by V.D. Blondel, J.L. Guillaume, R. Lambiotte and E. Lefebvre, in Journal of Statistical Mechanics: Theory and Experiment 2008 (10), P10008 (12pp).

The algorithm starts by assigning each node to its own community. Then, iteratively tries to construct communities by moving nodes from their current community to another until the modularity is locally optimized. At the next step, the small communities found are merged to a single node and the algorithm starts from the beginning until the modularity of the graph cannot be further improved.

If no weights are given, the algorithm will assume that all edges have edge weights equal to 1.

Other Clustering Algorithms

yFiles for HTML supports a number of other clustering algorithms:

Examples

Calculating clusters of a graph using the Louvain method
// prepare the louvain modularity algorithm
const algorithm = new LouvainModularityClustering()
// run the algorithm
const result = algorithm.run(graph)

// highlight the nodes of the clusters with different styles
for (const node of graph.nodes) {
  const componentId = result.nodeClusterIds.get(node)
  graph.setStyle(node, clusterStyles.get(componentId))
}// prepare the louvain modularity algorithm
const algorithm = new LouvainModularityClustering()
// run the algorithm
const result = algorithm.run(graph)

// highlight the nodes of the clusters with different styles
for (const node of graph.nodes) {
  const componentId = result.nodeClusterIds.get(node)
  graph.setStyle(node, clusterStyles.get(componentId)!)
}

Type Details

yfiles module
view-layout-bridge
yfiles-umd modules
view-layout-bridge
Legacy UMD name
yfiles.analysis.LouvainModularityClustering

See Also

Constructors

Properties

Methods