Tuesday, November 23, 2004
Your job is to adapt this program to find the shortest distances from JFK to the other airports in the graph in Figure 12.14 (page 626) of the textbook. The data is stored in this file: airport.dat.
As noted in a comment in the DijkstraExample program, you
should replace the code that randomly generates a graph
(between "Point
A" and "Point B" in the source code) with a call to a
readGraph
method that fills in an empty graph
with the information from the airport.dat file, and returns
a list of the vertex objects that were added to the graph.
Make a copy of DijkstraExample.java file, called
"FlightFinder.java" and write the readGraph
method. Make sure you understand how the original program
generated the random graph. For your graph, the data stored
at vertices can be a String (the name of the airport) and
the data stored at edges can be anything you want (notice,
the data and the edge weight are two separate things).
Hand in a printout of all the commented Java program files that are necessary to make your program run correctly, and also submit them online through VikingWeb.