Library

Volume 2 · Knowledge Graphs

Notebook
Sign in

Cheat Sheet — Part 5: Knowledge Graphs

554 words · about 3 min

Key Terms

Term In one line
RDF Subject-predicate-object triples, SPARQL, OWL/RDFS ontologies, W3C standard
LPG Labeled Property Graph — nodes, edges, properties on both, Cypher/Gremlin
Index-free adjacency Traversing an edge is O(1) — the structural reason graphs beat joins on deep paths
Entity resolution Deciding that “IBM”, “I.B.M.” and “International Business Machines” are one node
Ontology The schema: entity types, permitted relationships, constraints
GraphRAG Vector search to find entry points, graph traversal to gather connected context
Multi-hop question One whose answer requires following 2+ relationships — where flat vector search fails

Numbers That Matter

Figure Value Where it bites
Graph beats relational Traversals beyond 2 hops The threshold worth quoting; below it, SQL joins are fine
Neo4j batch size 5,000–10,000 nodes per transaction Balances throughput against lock contention
Edge traversal O(1) via index-free adjacency vs a join that grows with table size
Aggregations Graphs are weaker here SUM/COUNT/GROUP BY and BI reporting stay relational

Decision Rules

  • Choose a graph when traversals exceed 2 hops, queries need variable-length paths, pattern matching spans multiple entities, the schema evolves frequently, or relationships are the use case.
  • Choose relational when it’s CRUD over a stable schema, aggregation and reporting are central, or you need mature cross-table transactional integrity and BI tooling.
  • Choose RDF when interoperability across organizational boundaries matters more than traversal speed — publishing a shared ontology multiple independent systems consume. Choose LPG when you own the graph and care about traversal performance and developer ergonomics.
  • Put properties on edges, not just nodes. Real relationships carry metadata — a date, a weight, a confidence, a role — and that metadata frequently changes the answer to the query.
  • Entity resolution is the hard part of ingestion, not extraction. Getting entities out is a solved-ish NER problem; deciding which extracted mentions are the same real thing is where the project lives or dies.
  • GraphRAG earns its complexity on multi-hop questions. “Which of our vendors is exposed to a supplier that failed an audit?” is a traversal; flat vector search cannot answer it at any chunk size. If your questions are single-hop lookups, a graph is expensive ceremony.

Say This Out Loud

“I’d reach for a graph database once relationship traversals go beyond about two hops, or when queries need variable-length paths. Below that, relational joins are perfectly good and you get better tooling and aggregation. The structural argument is index-free adjacency — following an edge is a constant-time pointer hop rather than a join whose cost grows with the table — so a five-hop query that would be a monstrous self-join becomes a natural traversal.”

“The genuinely hard part of building a knowledge graph isn’t entity extraction, it’s entity resolution. Extraction is a reasonably solved NER problem. Deciding that three differently-spelled mentions across four source systems are the same real-world entity is where the accuracy of the whole graph is decided, and it’s the piece people under-scope.”

“GraphRAG is worth the complexity specifically for multi-hop questions. If someone asks which of our vendors is exposed to a supplier that failed an audit, no chunk in the corpus contains that answer — it only exists as a path through relationships. Vector search finds entry points, the graph gathers the connected context, and the model synthesizes. If the questions are single-hop lookups, I wouldn’t build a graph at all.”