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 friends each person has, adjacency matrix is like a big table showing if two people know each other.
Adjacency List: 0: 1 -> 2 -> null 1: 0 -> 3 -> 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]
