LOGBOOK

HELP

Quiz Entry - updated: 2026.11.27

What does the adjacency list structure add to the edge list, and what does that buy?

Each vertex gets an incidence sequence with references to its incident edges, and each edge remembers where it sits in the incidence sequences of its two ends. incidentEdges(v) then costs $O(\deg(v))$, areAdjacent $O(\min(\deg(v), \deg(w)))$ and removeVertex(v) $O(\deg(v))$, while the space stays $O(n + m)$.

Adjacency list structure: each of u, v, w, z has a sequence of its incident edges; edge c is highlighted in u's and w's sequences

* Every edge appears in exactly two incidence sequences, one at each end. *

The space stays linear because every edge is listed exactly twice, once at each end, so all incidence sequences together hold $\sum_v \deg(v) = 2m$ entries. Counted exactly: $n$ vertex objects, $m$ edge objects and $2m$ incidence entries, $n + 3m$ in total, which is still $O(n + m)$. Each operation about one vertex now reads only that vertex's own sequence.

That combination, linear space and fast access to a vertex's edges, makes the adjacency list the standard choice for most graphs, which have far fewer edges than the maximum.

Go deeper:

  • doc Adjacency list โ€” variants of the structure and its trade-offs against the matrix.

From Quiz: ADS / Graphs: Basics, Representations and Spanning Trees | Updated: Nov 27, 2026