Draw an adjacency list and adjacency matrix representation of the undirected graph shown in Figure 13.1 (Pg. 594).
Suppose we represent a graph G having n vertices and m edges with the
edge list structure. Why, in this case, does the insertVertex
function run
in O(1) time while the eraseVertex
function runs in O(m) time?
Would you use the adjacency list structure or the adjacency matrix structure in each of the following cases? Justify your choice.
isAdjacentTo
as fast as possible, no
matter how much space you use.
Suppose we wish to represent an n-vertex graph G using the edge list
structure, assuming that we identify the vertices with the integers in the set
{0,1,...,n- 1}. Describe how to implement the collection E to support
O(logn)-time performance for the areAdjacent
function. How are you
implementing the function in this case? Justify the correctness and complexity of the algorithm.