CSE373 Data Structures Sp07, Homework 6 & 7

Electronic Turn-in of code due: 11am Wednesday, 5/30/07 using this link.
Printout of code due: At the beginning of class, Wednesday, 5/30/07
No late assignments will be accepted.

This assignment will be equal to 1.5 assignments in weight, although it will only have one due date.  In the assignment, you will develop a graph implementation and then use it to implement at least one graph algorithm.  In particular, you will implement (at least) Dijkstra’s algorithm for finding the shortest path.

For this assignment, (if you wish, not required) you may work with one partner for the programming portion of the assignment.  If you plan on working pairs: one partner MUST send email containing the names and email addresses of both partners to Anna by 11:59pm Wednesday May 23rd .

Part I.  Graph Representations (recommended due date Wednesday 5/23/07)

In this part of the assignment you will implement a graph representation to be used later in Part II.

The assignment has several files provided:

Fill in the remaining code for AdjListGraph.java, and Edge.java. Your code should be efficient and must have the minimal big-Oh possible for the given implementation.

 

Part II.  Graph Algorithms

In this part of the assignment, you will use the graph representation you created in Part I to read a description of a graph and answer questions about it.  In particular, you should use Dijkstra's algorithm to find shortest paths in the graph.

What to Do

Write a program that reads a description of an undirected graph with weighted edges, then answers questions about paths in that graph.  More specifically, the program should operate as follows:

Two sample data files are available representing information about airports and the distances between them.  File vertex.txt contains a list of 3-letter airport codes, each of which represents a vertex in the graph.  File edge.txt contains information about edges in the graph.  Each edge is described by two lines that each contain an airport code, and a third line giving the distance between them.  You may assume that every node name that appears in a path (edge) also appears in the vertex list.

You should use the graph implementation from Part I as a starting point. 

Extra Credit

A small amount of extra credit will be awarded for interesting extensions.  Here are a few possibilities:

What to Turn In

You should turn in the following electronically:

In addition, if you worked with a partner, 1) only one partner needs to submit the code electronically and make a printout.  2) Be sure that both partners’ names are listed in all files.  3) Include in your readme.txt file a description of how you developed and tested your code.  If you divided it into pieces, describe that.  If you worked on everything together, describe the actual process used – how long you talked about what, how long and in what order you wrote and tested the code.  Be sure to describe at least one good thing and one bad thing about the process of working together.