July 2018
Beginner
202 pages
5h 4m
English
The adjacency list representation of a graph consists of an array of |V| lists, one for each vertex in V. For each vertex u in V, there's a list containing all vertices v so that there is an edge connecting u and v in E. Figure 6.3 shows the adjacency list representation of the directed graph in Figure 6.1:

For undirected graphs, we follow a similar strategy and build the adjacency list as if it were a directed graph with two edges between each pair of vertices u and v, which are (u, v) and (v, u).
Figure 6.4 shows the adjacency list ...
Read now
Unlock full access