Operation | Adjacency list | Adjacency matrix |
Is v1 adjacent to v2? | ||
For a single vertex, find all vertices adjacent to that vertex | ||
For each vertex, find all vertices adjacent to that vertex | ||
Total space required. |
-- mark all vertices as unvisited -- insert the start vertex into an empty collection C -- while (C not empty) - remove a vertex v from C - if v has not been visited * visit v * insert all univisted adjacent nodes to v into C