Retrieval-Augmented GenerationRAGAdvanced RAG Architectures

What is graph expansion in RAG?

Graph expansion in RAG is the retrieval step that starts from one or more relevant entities (called *seed nodes*) and follows their graph relationships to collect additional, connected evidence. It broadens retrieval from a directly matched entity to useful neighbors without searching the entire graph.

Beginner-friendly example

A company's knowledge graph stores these relationships:

  • Checkout API → depends on → Payment Service
  • Payment Service → owned by → Platform Team
  • Payment Service → uses → Fraud Detector

A user asks: “Who owns the service that Checkout API depends on?”

  1. Seed: Retrieve the node Checkout API.
  2. One-hop expansion: Follow depends on to Payment Service.
  3. Two-hop expansion: Follow owned by from Payment Service to Platform Team.
  4. Ground the answer: Fetch the source documents for both edges, then answer “Platform Team” if the evidence confirms it.

The uses → Fraud Detector edge may be real but is irrelevant to this question, so the retriever should exclude it.

How is expansion controlled?

  • Starting entities: Identify seeds using entity names, full-text search, vector similarity, or an entity linker.
  • Hop limit: Restrict traversal depth—for example, 2 hops—so the search does not expand indefinitely.
  • Relationship filters: Follow only types relevant to the question, such as depends on and owned by.
  • Direction: Respect directed edges where meaning depends on direction.
  • Candidate ranking: Prioritize important or question-relevant paths, then deduplicate overlapping nodes and edges.
  • Budgets and permissions: Limit number of nodes, edges, runtime, and LLM context tokens; enforce access restrictions for every traversed item.
  • Evidence links: Recover source text supporting each selected relationship, rather than asking the model to trust graph edges alone.

Small numerical example

Suppose a seed has 5 neighbors, and each of those has 4 new neighbors.

  • At 1 hop, the search may consider 5 additional nodes.
  • At 2 hops, it may consider 5 + (5 × 4) = 25 additional nodes, assuming no shared nodes or cycles.

This rapid growth is called *neighborhood explosion*. Real graphs have overlaps, and pruning is essential for keeping retrieval focused and affordable.

Graph expansion vs query expansion

  • Graph expansion: Follow entity relationships to fetch connected facts.
  • Query expansion: Add alternative words or search queries to discover text that uses different wording.

Graph expansion also differs from entity resolution, which determines whether multiple names refer to the same entity.

When does it help?

Use graph expansion for multi-hop dependencies, ownership chains, connected incidents, and questions whose evidence spans documents. Avoid large or indiscriminate expansions for simple factual lookups; they add latency and irrelevant context. Benchmark answer quality and cost against simpler retrieval.

Interview takeaway: Graph expansion means start with relevant nodes → traverse selected edges for a bounded number of hops → rank and verify evidence → generate a grounded answer.

References: https://neo4j.com/labs/genai-ecosystem/graphrag/ and https://microsoft.github.io/graphrag/examples_notebooks/local_search/

Sources & Research References

#graph expansion in RAG#GraphRAG neighborhood expansion#graph traversal hop limits RAG#rag#graph-expansion#graph-retrieval#multi-hop

Learning Sequence

Retrieval-Augmented Generation Curriculum

78% Completed
Up NextRAG

What is multi-source RAG?

Explore Related Questions

Deepen your understanding across related Retrieval-Augmented Generation topics.

Machinoai Logo
Machinoai

Your edge in the AI era. Deep dives into machine learning concepts, paper explainers, verified industry jobs, and developer tools.

© 2026 Machinoai. All rights reserved.