Overview
Dense-Node Anti-Pattern
Why a single Country node connected to 100M Person nodes wrecks every traversal.
Why it matters
Traversal cost is O(degree). A 'God' node becomes a hub through which every query has to walk — even queries that have nothing to do with countries.
Going deeper
Why dense nodes are so toxic to traversals: when Cypher expands a relationship, it iterates the relationship chain of the source node. A node with 100M outgoing edges has a 100M-long chain. Any traversal through that node — even one looking for a single specific neighbour — pays a large fraction of that cost unless there's a relationship-property index helping it skip ahead.
Two refactors, in order of cost:
- Intermediate nodes (Region, Era, Bucket) that split the fan-out into smaller, more selective hops. Cheap, no Cypher rewrite at the leaves.
- Relationship type/property split — use distinct relationship types (e.g.
:RESIDES_IN_EU,:RESIDES_IN_US) so the traversal can ignore the non-matching chain entirely. Useful when intermediate nodes don't fit the domain.