"Who does our VP of Engineering report to?" should be an easy question. Imagine an assistant searching a company's documents and finding an old organization chart, a recent project update, and a biography of the CTO. All three mention the right people. Only one may describe the current reporting relationship.
A knowledge graph gives the assistant a more direct way to answer: find the person, follow the reporting relationship, and return the manager. That is useful. Whether the relationship is still correct depends on where it came from and when it was checked. Connecting an LLM to a graph makes those checks possible; it doesn't perform them automatically.
Follow the connection
A knowledge graph represents entities, such as people and companies, and named relationships between them. A simple way to read one is as subject, relationship, object:
(Albert Einstein) --[born_in]--> (Ulm, Germany)
(Albert Einstein) --[developed]--> (General Relativity)
(General Relativity) --[is_a]--> (Physical Theory)
(Ulm) --[located_in]--> (Baden-Württemberg)
These are schematic statements, not a query result. To answer "Which theories were developed by people born in Germany?", a program could follow the connections from theory to person to birthplace. It would also need a consistent identity for Ulm and a path connecting the place to Germany. A reader can fill that gap from the names above; the database needs it represented or supplied by the query.
That is the appeal of traversal: each step has a defined meaning. A passage search can find useful evidence, but a result mentioning both Einstein and Germany doesn't by itself establish the relationship you asked about. The graph makes that relationship explicit and queryable. A relational database can also represent these connections through joins; a graph is a modeling choice, not a prerequisite for accurate retrieval.
Two common models are RDF and property graphs. RDF represents statements as subject-predicate-object triples and uses identifiers to distinguish entities; SPARQL is its query language. Property graphs attach properties to nodes and relationships. That lets a reporting relationship carry its source and effective dates alongside the people it connects. Cypher and Gremlin are query languages used with property graphs. Amazon Neptune's documentation describes support for both models.
Turn a relationship into an answer
Let's use a fictional company, Acme, to keep the mechanics visible. The people, dates, and team size in this example are illustrative. Suppose an application has retrieved these records:
Context:
- Person: Jane Chen | Role: VP Engineering | Company: Acme Corp | Since: 2022
- Person: Jane Chen | Reports_to: Marcus Webb (CTO)
- Person: Jane Chen | Manages: Platform Team (12 engineers)
- Company: Acme Corp | Industry: FinTech | Founded: 2019
Question: Who does the VP of Engineering at Acme report to?
The application first resolves "VP of Engineering at Acme" to Jane Chen, then follows Reports_to to Marcus Webb. It can pass the records to the model as structured context, and the model can explain the result in ordinary language: "Jane Chen reports to Marcus Webb, the CTO."
This is context injection, one of the simplest integration patterns. It reduces the work the model must do to reconstruct relationships from prose. It also gives us a concrete answer to check against the retrieved records. There is no accuracy measurement in this toy example, and the model can still misread or embellish its context.
The next question I would ask is where that reporting line came from. Suppose the edge was extracted from a 2022 organization chart, while a later document says Jane has a new manager. The tidy answer above now needs revision. A useful system would retrieve the supporting document and the relationship's effective date. If it cannot resolve the conflict, it should say that the older chart names Marcus and the current reporting line is unconfirmed.
Provenance means keeping that trail back to the source. It lets a reader distinguish an approved personnel record from a sentence an LLM interpreted in a project update. Both can become edges in a graph. They should not receive equal authority just because they share the same storage format.
Retrieve the right part of the graph
An application doesn't need to send the entire graph to the model. It can retrieve a small connected portion, called a subgraph, that answers the question. This can work alongside vector retrieval, which finds passages with similar meaning.
The following Python sketch contrasts the two retrieval steps using Acme. The database objects are placeholders for application integrations, and the output is deliberately fictional:
# Vector retrieval finds passages relevant to the question.
chunks = vector_db.similarity_search("Who founded Acme Corp?", k=5)
# Graph retrieval follows a named relationship.
triples = knowledge_graph.query("""
MATCH (p:Person)-[:FOUNDED]->(c:Company {name: 'Acme Corp'})
RETURN p.name, p.role, c.founded_date
""")
# Illustrative result: [("Alex Rivera", "Co-founder", "2019")]The graph query asks specifically for people connected to Acme by FOUNDED. It doesn't have to infer a founder from a paragraph about the current CEO. Notice, though, that p.role is a property of the person. If that person has roles at several companies, the schema should attach the relevant role to a relationship or employment record. A precise query against an imprecise schema still gives you trouble.
For a real answer, I would retrieve the relationship's source and relevant dates as well. Vector search could then bring back the source passage for explanation or checking. The graph supplies the connection; the document supplies detail that a compact edge may have lost.
This is also why a graph can help with hallucinations without eliminating them. A language model generates text from its context and learned patterns. An answer can sound fluent even when its factual basis is weak. Retrieval adds evidence the model can use, including private or recent information, but a wrong edge, an incomplete query, or an unsupported addition in the final answer can still produce a wrong response.
Let the model write the query
A third integration pattern lets the LLM translate a question into a graph query. This is useful when users need to combine relationships without learning the query language themselves. This research-search example is an illustrative query, with no claimed execution result:
user_query = "Which researchers at MIT have published papers on attention mechanisms?"
# LLM generates the Cypher query
generated_query = """
MATCH (r:Researcher)-[:AFFILIATED_WITH]->(i:Institution {name: 'MIT'})
MATCH (r)-[:AUTHORED]->(p:Paper)-[:ABOUT]->(t:Topic {name: 'Attention Mechanisms'})
RETURN r.name, p.title, p.year
ORDER BY p.year DESC
"""
results = graph_db.run(generated_query)
# LLM then formats results into a natural language responseRead it as two connected checks: find researchers affiliated with MIT, then find their papers about the requested topic. The shared r keeps the author and the affiliated researcher tied to the same entity.
The query still leaves a meaningful ambiguity: does "at MIT" mean affiliated now or affiliated when the paper was published? There is no date condition on the affiliation. A good interface must resolve that distinction before treating the results as an answer.
Generated queries also need execution controls. Give the connection only the data access the user is allowed, restrict it to read operations, validate the query, and impose time and result limits. LangChain's Neo4j integration documents GraphCypherQAChain and warns about database permissions. The sketch above shows the translation mechanism; it omits those application controls.
Where Microsoft's GraphRAG fits
Our Acme example follows a specific relationship. A different question, "What problems keep recurring across all our project reports?", needs a view of the collection as a whole. Retrieving a few similar passages can miss themes spread across many documents.
Microsoft's GraphRAG addresses this through an indexing pipeline that extracts entities and relationships, groups densely connected entities using the Leiden algorithm, and creates community summaries. These communities are clusters in the graph, not necessarily departments or other real-world organizations. See the GraphRAG indexing dataflow.
Its global search builds partial answers from community reports and combines them. Its local search combines graph information with source text around relevant entities. Those are different retrieval strategies for different questions.
The GraphRAG paper reports improvements in answer comprehensiveness and diversity over a conventional RAG baseline for global sensemaking questions on datasets around one million tokens. That supports a specific use case, not a conclusion that graphs outperform vector retrieval on every question. The extracted edges and generated summaries also remain claims derived from documents. An extraction error can travel through the summaries unless you retain and check the underlying evidence.
Where the extra structure earns its keep
The useful applications share a need to follow relationships. In enterprise knowledge management, a question about which policy applies to a team may need the team's location, business unit, and policy version. A graph can connect those records, while the policy text supplies the actual conditions. A simple question with a clear answer in one document may need nothing beyond ordinary retrieval.
Medical terminology and drug interaction data offer another possible source of structured relationships. Legal documents contain citation and cross-reference networks. In either domain, those connections can help locate evidence; they do not establish that a clinical or legal decision is correct. The context of the case and the applicability of each source still matter. These are application possibilities, not evaluated systems presented here.
For fraud investigations, the same approach can expose paths through accounts and transactions for an investigator to inspect. A shared connection is a lead to examine, not proof of wrongdoing.
The cost is maintaining the meaning of all those connections. Someone must resolve duplicate entities, check extraction, track changed relationships, and decide how the schema evolves. Missing data needs an explicit outcome: "no matching relationship found" cannot silently become "the relationship does not exist." An LLM can propose additions from new documents, but approval rules and source records need to accompany that workflow.
For implementation, Neo4j offers a property graph route with an LLM query integration; Neptune supports RDF and property graph queries; and NebulaGraph is an open-source distributed graph database. Wikidata is a useful public example of statements that can carry qualifiers and references. Choose a data model around the relationships and their evidence before choosing a tool.
What I would require before adding a graph
For Acme's reporting question, a graph earns its place when it reliably connects the right person to a current reporting record and lets the answer point back to its source. Test the awkward cases too: two people with the same name, an expired relationship, conflicting documents, and a missing manager. Those reveal whether the system understands the limits of its records.
I would invest in a graph when recurring questions need those explicit paths and the organization can maintain them. The payoff is an answer whose steps you can inspect: which person was selected, which relationship was followed, and which source supports it. The LLM makes that answer easier to ask for and understand. The data work determines whether you should rely on it.
