-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestDijkstra.java
More file actions
28 lines (24 loc) · 877 Bytes
/
TestDijkstra.java
File metadata and controls
28 lines (24 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import java.io.IOException;
public class TestDijkstra {
public static void main(String [] args) {
String vertexFile = args[0];
String edgeFile = args[1];
String city1 = args[2];
String city2 = args[3];
MapReader myReader = new MapReader(vertexFile, edgeFile);
//try/catch block for IOExceptions below
try {
@SuppressWarnings("static-access")
Graph myGraph = myReader.readGraph(vertexFile, edgeFile);
myGraph.computeEuclideanCosts();
Graph shortestPath = myGraph.getWeightedShortestPath(city1, city2);
DisplayGraph display = new DisplayGraph(shortestPath);
display.setVisible(true);
//uncomment the line below to see the adjacency list
//myGraph.printAdjacencyList();
} catch (IOException e) {
System.out.println("Sorry, I couldn't find one or both of those files.");
e.printStackTrace();
}
}
}