What is a Knowledge Graph?
A knowledge graph is a structured representation of information that maps real-world entities (like people, places, or concepts) and the explicit relationships connecting them.
How does it work?
Information in a knowledge graph is stored as nodes (entities) and edges (relationships). A simple example looks like this:
Person (Node) → works at (Edge) → Company (Node)Company (Node) → located in (Edge) → Country (Node)
By storing data this way, an AI can traverse the graph to answer complex multi-hop questions like, "Which country does this person's employer operate in?"
What is it commonly confused with?
Distinguish a knowledge graph from:
- A vector database, which stores mathematical embeddings for similarity search.
- An ordinary document collection, which is unstructured text.
- A relational database table, which stores data in strict rows and columns.
- RAG itself, which is the overall retrieval architecture.
Why does it matter?
While vector databases are great at finding general semantic similarity, they struggle with precise, factual, relationship-based queries. Knowledge graphs provide highly structured facts that can be used alongside language models and RAG to drastically reduce hallucinations and improve reasoning.