Create the classes Limited Vertex and Limited Directed Graph that use the representation…
Create the classes Limited Vertex and Limited Directed Graph that use the representation described in Exercise 14.
Suppose that you have a weighted, directed graph in which the out degree and in degree of every vertex is at most 4. (See the previous exercise.) If the graph has n vertices, you could represent it by using an array that has n rows and 4 columns. Each of the n rows is associated with a different vertex in the graph. The entries in a row associated with vertex v are the vertices at the ends of the edges that begin at v. Since the out degree of a vertex can be less than 4, some entries in a row might be null.
What is the Big Oh of each of the following operations?
a. Testing whether two given vertices are adjacent
b. Finding all vertices adjacent to a given vertex