Adjacency list vs matrix
The same graph as lists of neighbours and as a grid of 0s and 1s, built edge by edge.
EdgesA-B, A-C, B-D, C-D, D-E
5 nodes. The lists start empty; the matrix already has 5 × 5 = 25 cells, all 0.
- compare
- swap or write
- settled
Space play · ← → step · Home End jump · drag the strip to scrub