CSCI 136 Assignment 8

Description

For this lab you will implement a solution to a very practical problem: how to get home for the summer (or how to plan your next vacation, if you prefer). You are to design a set of classes which will let you find shortest paths between pairs of points in a graph using Dijkstra's algorithm, as discussed in class. The program you write should allow the user to enter the name of a file containing information on highways connecting various locations in the United States. The program should then construct a graph based on this information. The user should then be able to enter pairs of cities. When a pair of cities is entered, a shortest path between the two cities should be computed, using Dijkstra's algorithm, and displayed.

There are three files available for testing your program: roadmap and small-roadmap and tiny-roadmap. They are available in the Assignments folder, in a folder named roadTrip data. Each line of the file contains information of the form:

city1 city2 roadName distance
The last line consists of the single string "end".

The final version of your program should contain a GUI into which the user can enter information, such as the source and destination cities, as well as the file to be searched.

Goals

The main goal of this assignment is to tie together many of the topics we have covered this semester, via the construction of a useful piece of software. The solution will involve several data structures, including files, graphs, and priority queues, along with an efficient, sophisticated (but not complicated) algorithm utilizing these structures. The problem is complex enough to require the design and use of a number of classes. Determining a good decomposition of the problem into appropriate components with simple, clear interfaces will therefore be very important.

Food for Thought

As mentioned above, this problem is complex enough to require careful design and decomposition; don't underestimate the importance of good planning. You will have to store similar, but not identical, collections of data in the different structures; it might be wise to make some utility classes that package data up in various useful ways.

The algorithm you are to implement is described in the text, but the implementation there makes use of a Dictionary, which we have not yet discussed in any detail. You should plan to implement your own solution, following the explanation and outline of the algorithm given in class. Take good notes and be sure you understand the algorithm well before beginning to code.

The GUI should be the last thing you work on; be sure that you have a working algorithm first. The GUI is not the main point of this assignment.

Use the smallest input file while developing/debugging your code, but be sure to test it on all three files before turning it in.

Consider each of the following questions carefully. Which implementation of the graph data structure will you use? Is one more appropriate than another? Which implementation of priority queues will you use? What if there is no way to get from your starting city to your destination? How will you recognize this, and how will you handle it?

What to hand in

This assignment is deceiving. The algorithm is quite straightforward, but as mentioned above, there are many data structures to coordinate, each of which will store similar, but not identical, descriptions of the data. Design your classes carefully. I will check designs in lab on Wednesday.

Your final program will be due in lab during the last week of class. As usual, place all of your code in a folder and drop it off in the CSCI 136 drop-off folder.