SynapCores

What Is GraphRAG? How It Works and How to Implement It (2026)

By , Founder & CTO, SynapCores · Published · Updated

Watch: RAG Tutorial: Your RAG Pipeline Is Lying to You (Fix It in SQL)

GraphRAG: vector retrieval plus graph traversal in one engine

GraphRAG is retrieval-augmented generation (RAG) where retrieval uses both vector similarity and graph traversal. Similarity search finds the passages or nodes that match the question by meaning. Graph traversal then follows typed relationships out from those matches (who filed this, which system it covers, which team owns that system) and brings the connected facts along. The LLM gets a small subgraph instead of a flat list of chunks, so it can answer questions that depend on how things are connected, and cite the path it used.

This guide covers what GraphRAG is, how it differs from traditional RAG, when it is worth the extra work, and how to implement it step by step. The runnable examples use SynapCores, where the vector hop and the graph traversal run in one Cypher statement; the concepts apply to any stack.

We build SynapCores. Every query below ran on SynapCores 2.4.3 Community Edition, which is free. The sections on what GraphRAG is and when to use it hold whatever you build on.

What GraphRAG is (and isn't)

A GraphRAG retrieval has four stages. You can run them as separate calls or fuse them into one query, but conceptually they are:

1. Seed:     find the top-k chunks or nodes by similarity to the question
2. Expand:   walk N hops out from the seeds along typed relationships, with filters
3. Rank:     score the expanded subgraph (relevance, recency, path length)
4. Pack:     hand the LLM the text, the nodes and the relationships, and ask it to cite them

Stage 2 is what makes it GraphRAG, and it is the stage most teams skip. They retrieve five chunks and hope the LLM can connect them. It can't, because the relationships were never in the context window.

What GraphRAG isn't:

  • It isn't "store your vectors in a graph database." Vectors that sit next to nodes don't make GraphRAG. You need relationship traversal in the retrieval path.
  • It isn't one algorithm. Microsoft's GraphRAG library builds community summaries over an LLM-extracted graph; Neo4j's neo4j-graphrag package pairs vector retrievers with Cypher expansion; LlamaIndex's PropertyGraphIndex retrieves paths plus source text. All are GraphRAG with different trade-offs. See how GraphRAG works with Neo4j, and the alternatives for a side-by-side.
  • It isn't only for document knowledge graphs. Any data with real relationships qualifies: customers and accounts, papers and citations, tickets and resolutions, devices and cards in a fraud ring, services and their owners.

GraphRAG vs traditional RAG

"Traditional RAG" is the pattern from the original 2020 RAG paper that most chatbot tutorials follow:

  1. Split the documents into chunks.
  2. Embed each chunk and store the vectors in an index.
  3. At question time, embed the question and fetch the top-k most similar chunks.
  4. Paste them into the prompt and let the LLM write the answer.

There is no model of what the chunks are, who they belong to or how they relate. That works well for questions with one chunk-shaped answer ("what is the refund policy?"). GraphRAG keeps the same vector index and adds entities, typed relationships between them, and a retrieval step that expands along those relationships.

Four failures traditional RAG can't fix

  1. Multi-hop synthesis. Chunk A says "Account 42 belongs to Org 7"; chunk B says "Org 7 had a billing incident in March". Similarity search may return both, but nothing tells the LLM they are connected. GraphRAG returns the Account 42 -[:BELONGS_TO]-> Org 7 edge with both.
  2. Entity disambiguation. "Did the user reset their password?" matches a thousand chunks. With a graph you scope retrieval to this user's tickets first, then search by meaning inside that scope.
  3. Time. Embeddings capture what a fact says, not when it stopped being true. Relationships can carry valid_from and valid_to, so retrieval filters out facts that no longer hold.
  4. Path citations. "Chunk #4837" is a citation. "Account 42 → Org 7 → Incident 19 → described in chunk #4837" is an audit trail a reviewer can follow.

Side by side

Traditional RAG GraphRAG
Retrieval returns A ranked list of chunks Chunks plus the nodes and relationships around them
Answers well "What does the corpus say about X?" "How is X connected to Y, and what supports it?"
Citations Per chunk Per path
Time to a first version Hours: chunk, embed, query Days to weeks: schema design and entity extraction
Moving parts One vector index Vector index + graph (+ sync between them, unless one engine holds both)
Query cost One similarity search Similarity search plus a traversal; measure the added latency on your data

The biggest hidden cost of GraphRAG is schema design: deciding what counts as an entity, which relationships matter and how to extract them. A graph whose only edge is (Document)-[:HAS_CHUNK]->(Chunk) is a list with extra steps; it adds latency and no signal.

When to use GraphRAG (and when not to)

Use GraphRAG when the question shape is relational:

  • "Which other accounts in this customer's organization hit the same issue?" (org graph)
  • "Which devices share a card with the flagged account?" (fraud graph)
  • "Which runbooks cover the system that is down, and who is on call for it?" (ops graph)
  • "Who else cited this paper, and what did they conclude?" (citation graph)

In each case the answer is a path. Traditional RAG can sometimes stumble onto the right chunks, but it can't express the path, so it can't filter on it, reproduce it or cite it.

Stay with traditional RAG when:

  • the content is genuinely flat: FAQ answers, product descriptions, standalone articles;
  • most questions can be answered from one chunk;
  • nobody on the team can design and maintain a graph schema;
  • the latency budget can't absorb a traversal step (autocomplete, for example).

A quick test: take 50 real user questions and label each "one chunk would answer it" or "needs connected facts". If more than about one in five need connected facts, GraphRAG is probably worth building.

How to implement GraphRAG, step by step

The example is a small operations knowledge base: runbooks, the systems they cover and the teams that own those systems. The question: "For a database incident, which related runbooks should I read, and who is on call for them?" Vector search alone finds runbooks that sound related. It can't say which systems they cover or who owns them, because those are relationships.

Step 1: Decide the entities and relationships

Start from the questions, not the documents. Here they need three node types and two relationships:

(:KbDoc {id, title, text, embedding}) -[:COVERS]-> (:KbSystem {name, tier}) -[:OWNED_BY]-> (:KbTeam {name, oncall})

Keep the schema as small as the questions allow. Every extra node type is something to extract, keep current and explain.

Step 2: Load the graph, with embeddings on the nodes you search by meaning

In SynapCores, nodes carry an embedding property, so the vectors and the relationships live in one store. The 5-dimensional vectors below keep the example short and deterministic; real document embeddings come from an embedding model (SynapCores' EMBED() returns 384-dimensional vectors with the default model).

MERGE (d1:KbDoc {id: "DOC-101", title: "Postgres failover runbook",
                 text: "Steps to promote a replica when the primary database is unresponsive",
                 embedding: [0.82, 0.10, 0.05, -0.06, 0.20]})
MERGE (d2:KbDoc {id: "DOC-102", title: "Database connection pool exhaustion",
                 text: "Diagnose and resolve exhausted connection pools on the database tier",
                 embedding: [0.79, 0.12, 0.03, -0.04, 0.22]})
MERGE (d3:KbDoc {id: "DOC-201", title: "CDN cache purge guide",
                 text: "How to purge and warm the CDN edge cache after a bad deploy",
                 embedding: [-0.31, 0.60, 0.18, 0.05, 0.11]})
MERGE (s1:KbSystem {name: "Payments DB", tier: "database"})
MERGE (s2:KbSystem {name: "Edge CDN", tier: "edge"})
MERGE (t1:KbTeam {name: "Core Data", oncall: "core-data-oncall"})
MERGE (t2:KbTeam {name: "Edge Platform", oncall: "edge-oncall"})
MERGE (d1)-[:COVERS]->(s1)
MERGE (d2)-[:COVERS]->(s1)
MERGE (d3)-[:COVERS]->(s2)
MERGE (s1)-[:OWNED_BY]->(t1)
MERGE (s2)-[:OWNED_BY]->(t2);

Step 3: Seed by similarity

Find the documents closest in meaning to where the user is. In SynapCores the similarity search is a hop inside Cypher: [:SIMILAR_TO > 0.85] walks to the nodes whose embeddings are within that cosine similarity, using an HNSW index.

MATCH (seed:KbDoc {id: "DOC-101"})-[:SIMILAR_TO > 0.85]->(related:KbDoc)
RETURN related.id AS id, related.title AS title;

On SynapCores 2.4.3 this returns DOC-102 | Database connection pool exhaustion. The CDN guide is far away in meaning, so it doesn't come back.

Step 4: Expand along relationships, with filters

Now the GraphRAG step: from the similar documents, walk to the systems they cover and the teams that own them, and keep only database-tier systems.

MATCH (seed:KbDoc {id: "DOC-101"})-[:SIMILAR_TO > 0.8]->(doc:KbDoc)
MATCH (doc)-[:COVERS]->(s:KbSystem)-[:OWNED_BY]->(team:KbTeam)
WHERE s.tier = "database"
RETURN doc.title AS runbook, team.name AS owning_team, team.oncall AS page;

On 2.4.3 it returns one row:

runbook                              owning_team  page
-----------------------------------  -----------  ----------------
Database connection pool exhaustion  Core Data    core-data-oncall

That row is the context vector search alone can't produce: the related runbook and who to page for it, found in one statement with no second system.

Step 5: Rank, then pack the context for the LLM

With more data, rank the expanded results before they reach the prompt: by similarity, by recency, by path length, or with the LLM itself. In SynapCores, llm_score(prompt, node) scores each row inside the same query; the knowledge-base recipe adds it to the statement above. Then pass the LLM the text of each node and the relationships that connect them, so it can say "DOC-102 covers Payments DB, which Core Data owns" instead of guessing.

Step 6: Generate the answer, and make it cite the path

Ask the model to answer only from the context and to cite the nodes it used; the RAG with citations recipe builds that prompt in SQL, with a citation handle on every source. Then check the citations before you show the answer: the RAG citation-check recipe checks that each cited source supports the sentence that cites it, and the guide to checking an AI answer against your documents explains the method.

For a full app around this pattern, see build a local RAG app with citations in one database, and for bigger graphs, the GraphRAG multi-hop Q&A recipe.

Architecture: two stores or one engine

Five-service GraphRAG stack vs one-engine GraphRAG

The common GraphRAG stack has a vector database for the embeddings, a graph database for the relationships, a relational database for everything else, and orchestration code (LangChain, LlamaIndex or your own) that calls them in turn. Each piece is fine on its own. The cost is in the seams: every entity write goes to two or three stores, every retrieval fans out across them, and every bug starts with "which store is stale?"

Two-store GraphRAG vs one-engine GraphRAG sync cost

The alternative is an engine where vectors, graph and SQL share one store and one query planner, so the similarity hop and the traversal run in one statement and there is nothing to sync. That is the design SynapCores follows. It is not the only right answer: if your graph is large, graph-native and dependent on graph-algorithm libraries, a dedicated graph database next to a vector index is a reasonable choice, and the Neo4j GraphRAG guide covers that path. Count the seams before you pick.

Where to go next

Try it: the free Community Edition runs every query on this page, or start in the Playground, which runs Cypher graph traversal and vector search in your browser.