The shape of the problem
The relational tax on connected questions
How many people, at most 3 friendship-hops away, work at companies founded after 2015? — in SQL this is three or four JOINs plus a recursive CTE. In a property graph it is four lines of Cypher and the engine walks pointers instead of computing Cartesian products.
A property graph has three primitives:
- Nodes — entities (
Person,Company,City). - Relationships — typed, directed edges (
(:Person)-[:WORKS_AT]->(:Company)). - Properties — key/value data on both nodes and relationships.
Neo4j stores relationships as first-class records with direct pointers, so a traversal is O(degree) — not O(table-scan + hash-join).