Graph
5 vertices, labelled 0..4. Add edges, then
toggle the three views below to see how the same graph is
stored as a matrix, a list, and an edge list.
How To Read It
Matrix: cell (u,v)=1 means an edge. O(1) lookup, O(V²) space.
List: each vertex maps to its neighbors. O(V+E) space, fast iteration.
Edge list: a flat array of pairs. Smallest, but O(E) to find anything.