Expand description
Community detection (Leiden algorithm) for graphify.
Partitions the knowledge graph into communities using the Leiden algorithm, which improves upon Louvain by adding a refinement phase that guarantees well-connected communities. Falls back to greedy modularity when refinement yields no improvement.
Functionsยง
- cluster
- Run community detection on the graph. Returns
{community_id: [node_ids]}. - cluster_
graph - Run community detection and mutate graph in-place, storing community info.
- cohesion_
score - Cohesion score: ratio of actual intra-community edges to maximum possible.
- score_
all - Compute cohesion scores for all communities.