Adjacency list
Applies to: general, python
An adjacency list represents a graph as a map from each node to its neighbors. It is compact for sparse graphs and is the representation behind most graph traversals.
adj = {0: [1, 2], 1: [0, 3], 2: [0], 3: [1]}
for neighbor in adj[0]:
visit(neighbor)