From Relationships to Communities
GraphRAG has already turned text into a knowledge graph, but a graph containing thousands of entities and relationships is not yet a practical global index. The problem now is structural: how can the system divide a connected corpus into manageable scopes without losing the relationships that make a whole-corpus answer meaningful? Community detection supplies that division. Understanding its recursive hierarchy lets the reader predict what a broad or detailed GraphRAG answer can see, and where the structure may mislead it.
Why graph modularity matters
A flat entity list tells us what was extracted, but not how the elements organize themselves. Even a flat graph of nodes and edges leaves a global summarization task with too much material to present at once. The system needs units that are large enough to express a theme and small enough to summarize within a model’s context window. GraphRAG uses communities for this purpose: groups of strongly connected graph elements that can be described together.
“Strongly connected” should be read as a property of the extracted graph, not as a claim about an objective social or scientific grouping. If many relationships link a set of entities to one another, while relatively fewer links cross into other sets, a community-detection algorithm can treat that pattern as a coherent region. GraphRAG relies on the graph’s modularity—the tendency for connections to be denser within some groups than between them—to create candidate scopes for summarization.
That is a different use of a graph from simply following edges to answer one question. A query-time traversal might start at one entity and walk to related entities. GraphRAG instead uses the graph to partition the entire indexed corpus, then summarizes the partitions. The distinction matters for a global question. A traversal can be excellent for following one chain; communities offer a way to cover many regions in parallel.
The partition is not a hand-written taxonomy. It is induced by the entities, relationships, and edge weights produced during extraction and consolidation. If the extraction stage recognizes a meaningful relationship, that connection can help keep the elements together. If an alias remains split, or a relationship is missing, the topology presented to the community algorithm changes. The community is consequently a computationally useful view of the indexed evidence, not an independent authority that corrects the evidence.
How the hierarchy is formed
The reported GraphRAG pipeline uses the Leiden community-detection algorithm recursively. It first finds a partition of the graph into root-level communities. It then examines each community for internal structure and detects sub-communities within it. The process continues until a community can no longer be usefully partitioned under the algorithm’s stopping behavior. The result is a hierarchy: broad communities contain narrower communities, which can contain still narrower ones.
Recursion is what turns a one-time clustering result into several levels of scope. A flat partition would offer one answer to the question “what belongs together?” A hierarchy offers a sequence of answers. At the top, the system can describe major regions of the graph. Lower down, it can expose the internal structure of one of those regions. The same entity can therefore participate in a broad parent community and a more focused descendant community without being duplicated as a different underlying node.
At any one level, the paper describes the communities as mutually exclusive and collectively exhaustive. Mutually exclusive means that a graph node belongs to one community in that partition rather than being assigned to several competing groups at the same level. Collectively exhaustive means that the partition covers the graph’s nodes rather than selecting only the most interesting ones and silently discarding the rest. These properties are important for divide-and-conquer summarization: the system can reason over a set of community units while retaining a defined relationship to the full indexed graph.
The properties do not mean that communities are semantically perfect. Exhaustive coverage of nodes is not the same as complete coverage of meaning. A node may be extracted with an incomplete description. A relationship may be represented in the wrong direction or with insufficient qualification. An important idea may not become a node at all. The partition can be complete relative to the graph while the graph itself remains incomplete relative to the source corpus.
The state diagram represents a structural transition, not a sequence in which the graph changes its identity. The graph is the input; community detection creates a root partition; recursion explores internal structure; and the leaf condition ends the descent for that branch. Different branches can reach their stopping points at different depths. A hierarchy is therefore not necessarily a perfectly balanced tree.
The word “root” can also be confusing. It does not mean that one root community contains all the useful detail. It refers to a high level of the community hierarchy, where there are relatively few, broad units. A lower level contains more numerous, narrower units. In the paper’s example of Leiden output, one level corresponds to a root partition and the next reveals internal structure within those root communities. The labels describe position in the hierarchy, not a universal semantic meaning such as “root equals topic” or “leaf equals fact.”
This structure creates a natural scope-and-detail control. Root communities are broad enough to support an overview. Their summaries can combine many relationships into a small number of reports, but the compression may hide fine-grained examples. Lower-level communities expose more local structure. They give a later summarizer more units and potentially more detail, but they also create more reports to process and a larger aggregate context burden.
The trade-off is easiest to see with a hypothetical transcript collection. Suppose the extracted graph contains recurring connections among researchers, institutions, policy discussions, and technical themes. A root-level community might gather a broad region in which several of those subjects interact. Its summary could explain the region’s main structure. A lower-level community might isolate a particular relationship between research and policy, making a more focused answer possible. Neither level is automatically correct for every question: the first favors scope and reuse, while the second favors detail.
The hierarchy is valuable because the summaries built on it can be reused. A global question does not have to begin with thousands of raw chunks. It can choose a level whose number and granularity of summaries fit the intended answer process. That is the bridge between graph structure and query-focused summarization. Community detection does not answer the user’s question by itself; it prepares units that a later summarizer can combine.
There is also a difference between graph-induced communities and ordinary hierarchical text summaries. A text summarizer can divide documents by position or recursively summarize chunks. GraphRAG’s communities are formed from extracted relationships, so a group can bring together elements that are connected across document boundaries. This can reveal a theme that no single document contains as a heading. The benefit depends on the relationships being extracted and matched well enough to create that connection. If the graph has no edge joining two relevant discussions, the community hierarchy cannot discover the connection through topology alone.
That dependency gives the hierarchy a clear failure path. A missed entity can remove a participant from every community. A false relationship can pull unrelated elements together. An alias split can lower the apparent degree of an important entity and scatter its evidence. A community algorithm may still produce a neat, exhaustive partition in each case, because its job is to organize the graph it receives. Neatness is not validation. The quality of the hierarchy is bounded by the quality of the representation beneath it.
The hierarchy also does not settle the question of importance. A high-degree entity may be prominent because it appears repeatedly, because the corpus discusses it across many contexts, or because the extraction process favors its name. A low-degree entity may still be crucial to a user’s question. Community structure can guide prioritization, but later summarization must decide how prominence and relevance interact. GraphRAG’s later report generation uses graph information to prioritize material, which makes the hierarchy a resource-allocation mechanism as well as a thematic organization.
The practical judgment is therefore conditional. Use a broad level when the task needs a reusable overview and the query-time budget is tight. Move toward lower levels when the answer needs the internal distinctions that broad summaries compress. Keep the full hierarchy available because the best level can depend on the question, not because deeper always means better. A global system needs both coverage and an appropriate scale of explanation.
A useful way to test the hierarchy is to ask what happens to a relationship that crosses a community boundary. The nodes at either end may be assigned to different groups at the same level, even though the edge between them remains part of the graph. That is not necessarily an error. Some themes are defined by their connections across regions. But it means a summary of one community may show only one side of the relationship. A later answer process must be able to combine community reports if it is to recover the cross-boundary pattern. Partitioning creates manageable units; it does not turn every important relationship into a self-contained unit.
The same point applies to the word “complete.” A level can be complete as a partition while still being incomplete as an explanation. Every graph node may have an assigned home, yet the description of that node may omit a qualification, and an edge may not carry all of its temporal or causal context. Community detection works on the representation supplied to it. It does not reopen the original paragraphs to check whether an extracted grouping is justified. The hierarchy organizes available evidence; it does not add a separate layer of factual validation.
Imagine a collection of technology transcripts in which discussions of policy, privacy, and product design recur across many episodes. A community algorithm might place a set of organizations and policy concepts in one dense region and place particular product discussions in another, while retaining edges between the regions. A broad summary could explain that the regions are connected. A lower-level summary could preserve the specific organizations or events that make the connection meaningful. If the question asks for the overall relationship between policy and design, using only one lower-level group would narrow the answer incorrectly; if it asks for a particular product discussion, using only a root-level report could erase the useful detail. The hierarchy provides both views, but the question still determines which views must be assembled.
This is why hierarchy level should be treated as a query and resource decision, not as a quality ranking. Root-level communities are few and broad. They make it easier to process a corpus-wide question with a limited context, and their summaries can be reused across many broad queries. Lower-level communities are more numerous and narrower. They can preserve distinctions that a root report has compressed, but they increase the number of summaries that a later map step must consider. An intermediate level may be a practical compromise when the user needs more detail than an overview but does not need every leaf report.
The paper’s later comparisons give these levels short labels, but the labels do not carry a universal meaning outside the hierarchy that produced them. A root in one corpus is not guaranteed to cover the same semantic breadth as a root in another. The number of levels and the number of communities depend on the extracted graph and the behavior of the detection algorithm. Comparing levels therefore requires asking what their summaries contain and what the query needs, rather than assuming that a deeper level is automatically more informative.
Once the graph has been partitioned, the main indexing model is complete enough to inspect as a whole. Text has become extracted elements; repeated elements have become graph structure; graph structure has become nested scopes. The remaining question is what this organization preserves and what it has already compressed. That distinction must be clear before community summaries are treated as the evidence for a global answer.