Graph Theory37 sections · 1633 units
Open in Course

Adjacency List - Visual Example

Seeing the Lists

Nodes: 11, 22, 33. Edges: (11-22) and (22-33). The List looks like this:

1: [2]
2: [1, 3]
3: [2]

Notice how much smaller this is? You do not store any zeros. Node 11 only lists node 22 because that is its only neighbor. Node 22 lists both 11 and 33 because it connects to both. If you had 10001000 nodes but only 1010 edges, you would store roughly 2020 entries total instead of 11,000000,000000 cells. That is the power of adjacency lists.