-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestBfs.java
More file actions
28 lines (24 loc) · 761 Bytes
/
TestBfs.java
File metadata and controls
28 lines (24 loc) · 761 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 TestBfs {
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);
//read in the file and get the shortest path
try {
@SuppressWarnings("static-access")
Graph myGraph = myReader.readGraph(vertexFile, edgeFile);
Graph shortestPath = myGraph
.getUnweightedShortestPath(city1, city2);
DisplayGraph display = new DisplayGraph(shortestPath);
display.setVisible(true);
//throw an exception
} catch (IOException e) {
System.out
.println("Sorry, I couldn't find one or both of those files.");
e.printStackTrace();
}
}
}