18: Graphs

Submit this homework using Gradescope. You can type up your answers, or write legibly and scan them. Do not attempt to submit a paper copy in class, as it will not be accepted.


Suppose you have an undirected graph with vertices V = {1, 2, 3, 4, 5, 6, 7}. Further suppose:

  • that vertices {1, 2, 3, 4} form a complete subgraph
  • that vertices {5, 6, 7} are a connected component
  • that vertices {5, 7} are not adjacent
  • that there is no path from vertex 1 to vertex 5

(You may want to review the relevant lecture notes.)

A. (1 point) Draw the graph.

B. (1 point) Show the adjacency list representation of the graph described above. For example, for the undirected graph where A is a neighbor of B, and B is a neighbor of C would be represented as:

A -> [B]
B -> [A, C]
C -> [B]

C. (0 points) Don’t show the adjacency matrix representation of the graph described above. Ain’t nobody got time to ASCII-art out a 7x7 matrix. Seriously, go outside for a walk or something.