Quiz 1, Thursday, 9/11

(20 minutes. Open notes)


  1. Consider a graph whose vertices are the numbers 1, 2, ..., 10 and whose edges connect pairs of numbers that have a common factor larger than 1. For example, there would be an edge connecting 6 and 8 because 2 is a common factor.

    Draw this graph and then show its adjacency matrix representation. Do this by showing the contents of the data members names and edges in the myGraph class. Ignore the fact that names is a String array whereas the vertices of the above graph are integers.

  2. Delete vertex 8 from the above graph. Show the contents of the data members names and edges now.