graph-ml/ Community Algorithms
Last Updated: October 20, 2018

Discovering clusters, groups, and hidden structures in connected data.

Community Algorithms

Community algorithms group together vertices that are more densely connected to each other than to the rest of the graph. This is essential for segmentation and fraud detection.

1. Louvain Modularity

Louvain is a multi-step algorithm that optimizes "modularity" to find high-level communities.

  • Dynamic: It doesn't require you to specify the number of communities in advance.
  • Hierarchical: It can find communities within communities.
  • Use Case: Customer segmentation and uncovering organizational structures.

2. Label Propagation (LPA)

A fast, simple algorithm where each vertex adopts the label that most of its neighbors have.

  • Speed: Extremely fast and parallelizable.
  • Use Case: Real-time community discovery in streaming data.

3. Connected Components

Finds isolated "islands" in your data.

  • Weakly Connected (WCC): Finds groups where nodes are connected regardless of edge direction.
  • Strongly Connected (SCC): Finds groups where every node can reach every other node following directed edges.
  • Use Case: Identifying fraud rings where several accounts are tightly linked.

4. Triangle Counting

Counts the number of triangles in a graph, which is a measure of "clustering" or local density.

  • Use Case: Measuring the stability of a social network or finding high-density trading groups.

[!TIP] Use Louvain for high-accuracy clustering where performance is less of a concern, and LPA for rapid discovery on massive, fast-changing datasets.