Skip to content
SDB
Knowledge Graphs

Chapter 01 · beginner · 15 min

What Is a Knowledge Graph?

Understanding nodes, edges, and the triple as the atomic unit of knowledge

Subhendu Datta BhowmikAI Tutorials

What Is a Knowledge Graph?

A knowledge graph is a structured representation of real-world entities and the relationships between them. Think of it as a web of facts — where every fact connects two "things" (nodes) through a labeled relationship (edge).

Unlike a relational database (which stores data in rigid tables with fixed schemas), a knowledge graph is schema-flexible and models the world the way we naturally think about it: as a network of interconnected concepts.

A Simple Analogy

Imagine a map of people you know. Each person is a dot (a node). Each connection between them — "Alice knows Bob", "Bob works at Acme Corp" — is an arrow (an edge). The label on the arrow tells you how they are connected. That's a knowledge graph.

Knowledge graph6 nodes · 7 edges

Nodes

  • Aliceperson

    A software engineer

  • Bobperson

    A data scientist

  • Acme Corporganization

    A technology company

  • Londonplace

    Capital city of England

  • Pythonskill

    A popular programming language

  • Machine Learningskill

    A field of artificial intelligence

Edges

  • aliceknowsbob
  • aliceworksAtacme
  • bobworksAtacme
  • acmelocatedInlondon
  • alicehasSkillpython
  • bobhasSkillpython
  • bobhasSkillml
An example knowledge graph with people, organizations, places, and skills. Click any node to see its properties.

The Building Blocks

Every knowledge graph is built from three fundamental components:

1. Nodes (Entities)

Nodes represent real-world things — people, places, organizations, concepts, events. Each node has:

  • An identifier (a unique ID or URI)
  • A type (e.g., Person, Company, City)
  • Properties (key-value attributes like name, age, founded date)

2. Edges (Relationships)

Edges connect two nodes and represent a relationship between them. Edges are:

  • Labeled (the label describes the relationship type, e.g., "worksAt", "knows", "locatedIn")
  • Directed (they have a source node and a target node)
  • Optionally carry properties themselves (e.g., a "worksAt" edge might have a "since" date)

3. The Triple

The most fundamental unit in a knowledge graph is the triple:

(Subject) —[Predicate]→ (Object)

For example:

  • Alice —[worksAt]→ Acme Corp
  • Acme Corp —[locatedIn]→ London
  • Alice —[hasSkill]→ Python

Triples are composable — combine enough triples and you have a rich, interconnected graph of knowledge.

Knowledge Graphs vs Relational Databases

FeatureRelational DBKnowledge Graph
StructureFixed tables, rows, columnsFlexible nodes and edges
SchemaRigid — changes require migrationsFlexible — add new node types freely
RelationshipsForeign keys (indirect)First-class edges (direct)
Multi-hop queriesExpensive JOINsNatural graph traversal
Adding new typesSchema change requiredJust add new nodes/edges

The key advantage of a knowledge graph is how easily it handles complex, multi-hop queries: "Find all employees who work at companies located in cities where the CEO has a PhD in Computer Science." In a relational DB this requires many JOINs; in a knowledge graph it's a natural path traversal.

Real-World Knowledge Graphs

Knowledge graphs power many technologies you use every day:

  • Google Knowledge Graph — the info panel you see when searching for a person, place, or concept. Google uses it to understand entities and their relationships, enabling richer search results.
  • Wikidata — a free, collaborative knowledge base with over 100 million statements. It powers Wikipedia's structured data and is used by researchers worldwide.
  • Microsoft Academic Graph — connects papers, authors, institutions, and citations.
  • Amazon Product Graph — connects products, attributes, brands, and categories for recommendations.
  • LinkedIn Economic Graph — connects professionals, companies, skills, and jobs.

Knowledge check

In the triple "Alice worksAt AcmeCorp", what is the predicate?

Summary

In this chapter you learned that:

  1. A knowledge graph represents entities as nodes and relationships as labeled directed edges
  2. The atomic unit is the triple: Subject → Predicate → Object
  3. Knowledge graphs are schema-flexible, making them ideal for heterogeneous, evolving data
  4. They power real-world systems like Google Search, Wikidata, and Amazon recommendations

In the next chapter, we'll dive into RDF — the W3C standard for representing knowledge graph data — and explore how triples are serialized into different file formats.

Knowledge Graphs