# 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.

Also called: graph database, knowledge graph RAG, GraphRAG, ontology, entity graph. Category: Data and retrieval. Source: https://aibuildindex.com/glossary/knowledge-graph

## In the index

- Data modeling: median $4,000, middle half $880 to $10,800, 89 priced briefs (https://aibuildindex.com/skills/data-modeling)

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](https://aibuildindex.com/glossary/named-entity-recognition) and language-model [data extraction](https://aibuildindex.com/glossary/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](https://aibuildindex.com/glossary/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](https://aibuildindex.com/glossary/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

- [Knowledge base](https://aibuildindex.com/glossary/knowledge-base): A knowledge base is an organised collection of a business's information, such as help articles, policies, product details and past answers, that people or AI systems consult to answer questions consistently.
- [Retrieval-augmented generation (RAG)](https://aibuildindex.com/glossary/retrieval-augmented-generation): Retrieval-augmented generation is a way of answering questions with a language model that first looks up relevant passages in your own documents, then writes an answer grounded in what it found.
- [Named entity recognition (NER)](https://aibuildindex.com/glossary/named-entity-recognition): Named entity recognition is a natural language processing technique that finds and labels specific items in text, such as people, companies, places, dates, amounts and product codes, so they can be extracted, linked or redacted.
- [Data extraction](https://aibuildindex.com/glossary/data-extraction): Data extraction is the process of pulling specific fields or records out of unstructured or semi-structured sources, such as documents, emails, web pages or transcripts, and returning them in a consistent, structured format.
- [Semantic search](https://aibuildindex.com/glossary/semantic-search): Semantic search is search that matches by meaning rather than exact words, typically by comparing embeddings, so a query such as "how do I get my money back" can find a page titled "Refund policy".
- [Data warehouse](https://aibuildindex.com/glossary/data-warehouse): A data warehouse is a central database designed for analysis, where cleaned data from many business systems is stored together so teams can run reports, dashboards and AI queries across all of it.
