Builds communities by starting from singleton partitions, moving nodes to improve quality, refining the partition, then aggregating and repeating until improvement stops. section 14.1 section 14.1
Here, it serves community detection for GraphRAG indexing, where better-separated clusters support later summarization and query answering. section 14.1 section 14.1
Key implementation points shown here:
- Starts from a singleton partition with each node in its own community. section 14.1
- Moves nodes between communities using modularity gain as the score. section 14.1
- Refines the partition before building the aggregated network. section 14.1
- Repeats move and aggregate steps until no further improvement is possible. section 14.1
GraphRAG community detection
A Python implementation computes modularity gain, aggregates communities, runs Leiden on the combined graph, then groups nodes into community text for summarization. section 14.1 section 14.1




