← Lessons

quiz vs the machine

Gold1420

Databases

Graph Database Traversal

Why following relationships is fast when edges are first class.

5 min read · core · beat Gold to climb

Graph Database Traversal

A graph database stores data as nodes connected by edges, where each edge is a real relationship with a type and direction. This suits social networks, recommendations, and fraud rings, where the connections matter as much as the data.

Index free adjacency

In a relational database, following relationships means joins that look up matching keys, and the cost grows with table size. Graph databases instead use index free adjacency: each node directly stores pointers to its neighbors. Hopping from one node to a connected node is a direct reference, not a search.

  • Traversals stay fast even as the whole graph grows.
  • Cost scales with the part of the graph you walk, not the total size.
  • Deep questions like friends of friends of friends stay cheap.

Queries

Graph query languages express patterns to match, such as find people who follow someone who bought this item. The engine starts at anchor nodes and walks edges to fill the pattern.

Key idea

Index free adjacency lets a graph database hop directly between connected nodes, so traversals cost as much as the path walked rather than the whole dataset.

Check yourself

Answer to earn rating on the learn ladder.

1. What is index free adjacency?

2. How does traversal cost scale in a graph database?