Skip to main content

Crate graphify_cluster

Crate graphify_cluster 

Source
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.