Community Detection¶
Find clusters and communities within graphs.
Louvain Algorithm¶
Fast modularity-based community detection.
import grafeo
db = grafeo.GrafeoDB()
algs = db.algorithms()
communities = algs.louvain()
for community_id, members in communities.items():
print(f"Community {community_id}: {len(members)} members")
Label Propagation¶
Semi-supervised community detection.
Connected Components¶
Find disconnected subgraphs.
algs = db.algorithms()
components = algs.connected_components()
print(f"Found {len(components)} components")
for i, comp in enumerate(components):
print(f"Component {i}: {len(comp)} nodes")
Strongly Connected Components¶
For directed graphs.
Weakly Connected Components¶
For directed graphs, ignoring edge direction.
Triangle Count¶
Count triangles for clustering analysis.
Use Cases¶
| Algorithm | Best For |
|---|---|
| Louvain | Large graphs, quality clusters |
| Label Propagation | Fast, scalable |
| Connected Components | Graph structure analysis |
| Triangle Count | Clustering coefficient |