Data Structures Project 4

Due: Wednesday, May 3, 2000.

In this project, you will construct your own reusable implementation of the UndirectedGraph ADT.

You are to also create a class, GraphAlgorithm, that performs the following (static) actions:

  1. isConnected(G): return true if and only if the UndirectedGraph G is connected.
  2. printAdjacencies(G): prints the adjacencies for each vertex of the UndirectedGraph G, with all the adjacencies for each vertex printed on a single line. (Note that this requires that each vertex has a way of printing itself or its element.) So, for example, the adjacencies for a triangle of three vertices could be printed as follows:
        0: 1, 2
        1: 2, 0
        2: 1, 0
    

You will test your GraphAlgorithm class with a main() method that performs the following actions:

  1. Create the UndirectedGraph G illustrated below (can be hard-coded into the main() method):

  2. Call GraphAlgorithm.printAdjacencies(G) on this graph.
  3. Perform the following action five (5) different times in a loop:
  4. Perform the following action five (5) different times in a loop: