Skip to content
AI|Course
← Implement GraphRAG with Knowledge Graphs

Lesson 4 of 7 · 2 hr

GraphRAG retrieval patterns

Once the graph exists, retrieval is where GraphRAG pays off. There is no single retriever; you choose a pattern per question type.

Watch

A four-minute comparison of GraphRAG with traditional RAG.

Watch on YouTube (opens in a new tab)Video by IBM Technology. The player loads only when you press play.

The patterns

1. Basic retriever

Plain vector search over chunks. Always build this first as your baseline. Everything else must beat it on your questions to be worth its complexity.

2. Vector search, then graph traversal

Find the best-matching chunks by embedding, then expand outward through the graph to pull in related entities, neighboring chunks and facts.

CALL db.index.vector.queryNodes('chunk_embeddings', 5, $questionEmbedding)
YIELD node AS chunk, score
MATCH (chunk)<-[:FROM_CHUNK]-(e:Entity)-[r]-(related:Entity)
RETURN chunk.text AS text,
       collect(DISTINCT e.name + ' -' + type(r) + '-> ' + related.name) AS facts,
       score
ORDER BY score DESC

The model receives the passage and the connected facts. (The index name, labels and relationship names are examples; match them to your schema.)

3. Hybrid search

Combine vector similarity with keyword (full-text) search, which rescues exact names, IDs and acronyms that embeddings blur.

4. Text-to-Cypher

Let the LLM write a Cypher query from the question, run it, and answer from the rows. It is excellent for aggregations and precise relationship questions ("how many orders per region last quarter") and brittle for vague ones.

Guard text-to-Cypher

Give the model your schema, add few-shot examples, run queries with a read-only database user, and cap result size. Never let generated Cypher write to your database.

5. Choosing between them

Question looks likeStart with
Find the passage about XBasic or hybrid retriever
What is connected to X, and howVector then traversal
Counts, filters, aggregationsText-to-Cypher
Themes across the whole corpusCommunity summaries (lesson 5)

Resources

Articlegraphrag.com
Basic Retriever pattern (opens in a new tab)

The first entry in the GraphRAG pattern catalog. Browse the rest of the catalog from here.

Free courseNeo4j GraphAcademy
Using Neo4j with LangChain (opens in a new tab)

Free course covering vector search, GraphRAG retrievers and text-to-Cypher in a working agent. Needs an LLM API key.

Free courseNeo4j GraphAcademy
Neo4j & Generative AI Fundamentals (opens in a new tab)

A gentler on-ramp to LLMs plus graphs if the course above feels fast.

DocsNeo4j
Retrievers in Neo4j GraphRAG for Python (opens in a new tab)

Look for the vector, vector-cypher, hybrid and text-to-Cypher retriever sections.

ArticleNeo4j Developer Blog
Create a Neo4j GraphRAG workflow using LangChain and LangGraph (opens in a new tab)

A more advanced, multi-stage workflow. Skim now, return after lesson 6.

Check yourself

  1. Write 15 questions about your corpus and tag each with the pattern you expect to win.
  2. Implement the basic retriever and one other pattern. Run all 15 questions through both.
  3. For each question, record which pattern gave the better answer and why. This table becomes your routing logic.

Found a broken link or a mistake? Report it (opens in a new tab).