# Knowledge graph

> Canonical: https://skillalmanac.com/glossary/knowledge-graph | Last verified: 2026-11-25 | Index status: index-eligible

A knowledge graph is a way of storing facts as a network: things such as people, products or concepts are nodes, and labelled links between them, called relationships, say how they are connected.

Also called: knowledge graphs, KG.

## In plain language

A knowledge graph is a map of facts. Each thing, such as a person, a company or a film, is a dot, and each fact about how two things relate is a labelled line between them: this person works at that company. Because the lines are stored, a program can follow them to answer questions like which suppliers are linked to this product. AI systems use graphs to give a model facts it can trace, rather than loose paragraphs. The main limit is effort: someone has to decide what the things and relationships are, build the graph from messy source material and keep it up to date, and a graph built wrongly gives wrong answers with confidence. IBM notes the term itself is debated, since some researchers treat it as the same as a knowledge base or ontology.

## Technical definition

A knowledge graph represents entities as nodes and relationships as typed, directed edges, usually stored in a graph database. In Neo4j's property graph model, nodes can carry labels, and both nodes and relationships can carry properties, which are key-value pairs. Neo4j's schema discussion covers indexes and constraints; it says an upfront schema is optional. Queries traverse edges, for example following a chain of relationships from one entity to related ones.

## How it shows up when you use agents

Most coding sessions never touch a knowledge graph. They show up when an agent or assistant must answer questions that depend on connections across many documents: which services call this one, which customers bought both products, who reports to whom. In that setting a graph can be built from your documents and the agent queries it, often through a tool or an [MCP server](/glossary/mcp-server), instead of reading everything. In practice this is one way to ground a [large language model](/glossary/large-language-model) in checkable facts, and it can be used alongside [retrieval-augmented generation](/glossary/retrieval-augmented-generation).

What breaks when it is misunderstood: a graph is treated as automatic truth. Its answers are only as good as the entities and relationships someone extracted and maintained, and an extraction mistake becomes a confident wrong link. Teams also underestimate the upkeep when the source documents change.

Next action: before building one, write three questions your users really ask and check whether they depend on relationships between things. If they only need a paragraph found, plain document search is simpler. If they do depend on relationships, start by hand-modelling a few dozen entities, before building an extraction pipeline. The linked diagram skills illustrate graph shapes; they are not demonstrations of a working knowledge-graph database.

## Common confusions

- **Knowledge graph versus vector database.** A graph stores explicit, named relationships. A [vector database](/glossary/vector-database) can store number lists, called [embeddings](/glossary/embedding), and retrieve items by vector similarity, which does not guarantee semantic relevance.
- **Knowledge graph versus ontology.** An ontology is a formal description of the entity and relationship types. IBM notes that some researchers treat the two as essentially the same, so check how a source uses each word.
- **Knowledge graph versus graph database.** The database is the storage technology. The knowledge graph is the content and structure placed in it.
- **Myth.** A knowledge graph stops an AI from making things up. It gives the model facts to use, but the model can still misread them, and the graph can contain errors.

## Worked examples in this catalogue

### [architecture-diagrams](https://skillalmanac.com/skills/skill-almanac/architecture-diagrams)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: Mermaid system and sequence diagrams that stay readable, checked for size and structure.

Why it exercises the concept: A system diagram is a small typed graph: components as nodes, calls and data flows as edges. It shows the node-and-relationship shape a knowledge graph formalises.

### [python-class-diagram-mermaid](https://skillalmanac.com/skills/skill-almanac/python-class-diagram-mermaid)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: A Mermaid class diagram generated from Python source files.

Why it exercises the concept: Classes and their inheritance and association links are entities and typed relationships extracted from code, which is how many knowledge graphs are populated.

### [terraform-resource-diagram](https://skillalmanac.com/skills/skill-almanac/terraform-resource-diagram)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: A Mermaid graph of Terraform resource and data blocks and the references between them, with unresolved references listed.

Why it exercises the concept: The diagram illustrates entities and dependency edges. Drawing it does not itself create a queryable knowledge graph or demonstrate graph-database operations.

## Related terms

- [Retrieval-augmented generation (RAG)](https://skillalmanac.com/glossary/retrieval-augmented-generation.md)
- [Large language model (LLM)](https://skillalmanac.com/glossary/large-language-model.md)
- [Embedding](https://skillalmanac.com/glossary/embedding.md)
- [Vector database](https://skillalmanac.com/glossary/vector-database.md)
- [AI hallucination](https://skillalmanac.com/glossary/hallucination.md)

## Sources

- [Graph database concepts](https://neo4j.com/docs/getting-started/appendix/graphdb-concepts/), Neo4j (accessed 2026-11-23)
- [What is a knowledge graph?](https://www.ibm.com/think/topics/knowledge-graph), IBM (accessed 2026-11-23)

Definitions are written by Skill Almanac from the sources above and checked against them on 2026-11-25. [Glossary index](https://skillalmanac.com/glossary.md).
