Adjacency Lists
Represent the adjacency matrix info as an array of lists, one for each row of the matrix.
The ith list contains the vertices to which vi is adjacent.
(Similar to the sparse array idea).
a b c d
a 0 1 1 1 a: b, c, d
b 0 0 0 0 b:
c 0 0 0 1 c: d
d 0 0 1 0 d: c
Efficent for getNeighbors(v)
Previous slide
Next slide
Back to first slide
View graphic version