Skip to main content
BVDNET
Arnhem · websites & automationBVDNET
Practical Applications

Knowledge graph

A knowledge graph stores facts as a network of things and their relationships, so software can follow the links; Google uses one for the boxes in its search results.

Also known as: kennisgraaf, KG, Google Knowledge Graph

A knowledge graph stores facts as a network: things such as people, companies, products and places, joined by named relationships, for example "Leonardo da Vinci painted the Mona Lisa". Software can follow those links to answer questions. Google's Knowledge Graph supplies the information boxes in its search results, including the box for a local business with its opening hours and phone number.

What does a knowledge graph look like?

Hogan et al. define a knowledge graph in their survey as a graph of data meant to collect and convey knowledge of the real world: the nodes are entities, the edges relationships between them. In RDF, the W3C standard for such graphs, each fact is a triple of subject, predicate and object. Wikidata, an open knowledge graph built by volunteers, stores these facts about the Mona Lisa, among others:

  • Mona Lisa, creator, Leonardo da Vinci
  • Mona Lisa, location, Louvre
  • Mona Lisa, inception, 1503

Leonardo da Vinci has facts of his own, so a query can follow the links further. In a property graph, the model behind graph databases such as Neo4j, nodes and edges can also carry properties, such as a date. RDF graphs are queried with SPARQL, property graphs with languages such as Cypher.

Where does the term come from?

The phrase is older, but Hogan et al. trace its current meaning to Google's announcement of May 2012: search should understand "things, not strings". At launch Google's graph held more than 500 million objects and 3.5 billion facts; in May 2020 Google put it at more than 500 billion facts about five billion entities. Airbnb, Amazon, eBay, Facebook, LinkedIn, Microsoft and Uber followed with knowledge graphs of their own.

Google calls its information boxes knowledge panels. Local businesses manage details such as opening hours through Google's business profile, and organisation structured data on a home page can influence which logo the panel shows.

How is a knowledge graph built?

Structured data, such as a customer database, can be mapped to a graph by fixed rules. Text takes more work. Hogan et al. describe three steps: named entity recognition finds the names of people, organisations and places; entity linking ties each name to the right node ("Rapa Nui" is Easter Island); relation extraction turns what the sentence says into edges. A large language model can also do the extraction; GraphRAG builds its graph that way.

How do knowledge graphs work with language models?

According to Pan et al. (2023), the two complement each other. A language model often falls short in capturing and accessing factual knowledge; a knowledge graph stores facts explicitly, but is hard to build and keep current. Pan et al. distinguish knowledge graphs that feed knowledge into language models during training or while answering, language models that help build and query knowledge graphs, and systems in which both work together. Facts from a graph give a model something checkable to base its answer on (grounding).

Where does it go wrong?

  • Gaps. Missing facts lead to incomplete query results, Hogan et al. note: the graph only knows what someone entered or extracted.
  • Stale or wrong facts. A correct graph goes out of date when nobody maintains it. Google writes that inaccuracies in its Knowledge Graph "can occasionally happen" and takes reports through a feedback link on each knowledge panel.
  • Effort. Neo4j, which sells a graph database, advises starting small, with one specific problem.

Example

Suppose a wholesaler in building materials keeps its customers, orders, products and suppliers in a graph. A supplier recalls a batch of wall plugs. One graph query follows the links from supplier to products to orders to customers and returns the customers to call. An order that was never linked to the product is missed.