Mental Model
Graphs can be stored in two main ways: adjacency lists store neighbors for each node, adjacency matrices store connections in a grid.
Analogy: Think of a city map: adjacency list is like a list of roads from each city to others, adjacency matrix is like a big table showing if two cities are connected directly.
Adjacency List: 0: 2 -> 1 -> null 1: 3 -> 0 -> null 2: 0 -> null 3: 1 -> null Adjacency Matrix: 0 1 2 3 0 [0 1 1 0] 1 [1 0 0 1] 2 [1 0 0 0] 3 [0 1 0 0]
