/
Driver.java
35 lines (28 loc) · 994 Bytes
/
Driver.java
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
33
34
35
import java.io.File;
import java.io.FileNotFoundException;
import java.util.List;
import java.util.Scanner;
import java.util.Timer;
public class Driver {
public static void main(String[] args) throws FileNotFoundException {
Scanner in;
if (args.length > 0) {
File inputFile = new File(args[0]);
in = new Scanner(inputFile);
} else {
in = new Scanner(System.in);
}
Graph g = Graph.readGraph(in, false);
System.out.println("Start time in nanoseconds: "+System.nanoTime());
List<Edge> EulerPath = EulerTrail.findEulerTour(g);
System.out.println("End time in nanoseconds: "+System.nanoTime());
if (!EulerPath.isEmpty()) {
System.out.println("Valid Tour & Euler Path :");
for (Edge e : EulerPath) {
System.out.println(e);
}
} else {
System.out.println("Not a valid Euler!");
}
}
}