Core idea
An adjacency list maps every vertex to the vertices directly connected to it.
It uses space proportional to vertices plus edges.
It is the common default for traversal and graph algorithms on sparse graphs.
How it works
- Create one list for every vertex.
- Append each destination vertex to the source list.
- For undirected graphs, append both directions.
- Store edge weights beside neighbors when needed.