-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBisonMaps.java
More file actions
32 lines (27 loc) · 1.09 KB
/
Copy pathBisonMaps.java
File metadata and controls
32 lines (27 loc) · 1.09 KB
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
29
30
31
32
/*************************************************************************
* Compilation: javac BisonMaps.java
* Execution: java BisonMaps mapfile < input.txt
* Dependencies: EuclideanGraph.java Dijkstra.java In.java StdIn.java
*
* Reads in a map from a file, and repeatedly reads in two integers s
* and d from standard input, and prints the shortest path from s
* to d to standard output.
*
****************************************************************************/
public class BisonMaps {
public static void main(String[] args) {
// read in the graph from a file
In graphin = new In(args[0]);
EuclideanGraph G = new EuclideanGraph(graphin);
System.err.println("Done reading the graph " + args[0]);
System.err.println("Enter query pairs from stdin");
// read in the s-d pairs from standard input
Dijkstra dijkstra = new Dijkstra(G);
while(!StdIn.isEmpty()) {
int s = StdIn.readInt();
int d = StdIn.readInt();
dijkstra.showPath(s, d);
System.out.println();
}
}
}