Data and retrieval

Knowledge graph

A knowledge graph stores information as entities, such as customers, products or contracts, and the named relationships between them, so that software and AI systems can answer questions that need several connected facts.

Some questions cannot be answered from a single passage of text. "Which of our suppliers share a parent company with a competitor?" or "Which contracts reference the clause we just changed?" need facts joined together across many sources. A knowledge graph is built for that: it records things and how they relate, as a network of nodes and links. With language models, knowledge graphs are being used both as a source of answers and as a way to make retrieval smarter, an approach often called GraphRAG.

How it works

The basic unit is a triple: subject, relationship, object. "Acme Ltd — is supplier of — Widget 200." "Widget 200 — is component of — Product X." Stored together, thousands of these form a graph that can be traversed: start at Product X and walk back through components to suppliers to their parent companies. Graph databases such as Neo4j, Amazon Neptune and others are designed for these traversals, with query languages like Cypher or SPARQL.

Building the graph is the hard part. Entities and relationships can come from structured systems such as a CRM or ERP, or be pulled out of text using named entity recognition and language-model data extraction. The same entity mentioned in different ways, "Acme", "ACME Ltd", "Acme Limited", has to be resolved to one node.

In a GraphRAG design, the system retrieves both text passages and the relevant part of the graph, so the model can see how facts connect rather than reading isolated paragraphs.

What it means for cost

Knowledge graph builds are significantly more involved than plain retrieval-augmented generation. Someone has to design the model of entities and relationships, extract and reconcile them, and keep the graph current as sources change. That is specialist data-modelling work, and the extraction step has its own accuracy testing.

The investment makes sense when the questions genuinely depend on relationships, as in compliance, supply chains, research, fraud investigation or complex product catalogues. Ask a builder which questions the graph will answer that document search could not, how entities are extracted and checked, and how the graph is updated.

When it is the wrong tool

If most questions can be answered by finding the right paragraph, a knowledge base with good search is cheaper and simpler. A knowledge graph built without clear questions in mind tends to become an expensive, outdated diagram.

Common questions

What is GraphRAG?

GraphRAG is a family of retrieval approaches that use a knowledge graph alongside, or instead of, plain text search. The graph helps the system gather connected facts and summaries of related material before the model writes an answer. It tends to help most on questions that span many documents.

Does a knowledge graph need a graph database?

Not always. Small graphs can live in an ordinary relational database or even in memory. A dedicated graph database helps when the graph is large and queries walk many links deep.

Related terms

Pricing a build that involves Knowledge graph? Send the brief and get a fixed price set next to the market range.Get a quote