Skip to content
Snippets Groups Projects
Commit 8be5badc authored by Anders Austlid's avatar Anders Austlid
Browse files

tests

parent a71a9a0c
No related branches found
No related tags found
No related merge requests found
No preview for this file type
File added
No preview for this file type
No preview for this file type
No preview for this file type
...@@ -86,7 +86,7 @@ class Graph { ...@@ -86,7 +86,7 @@ class Graph {
} }
public Edge getShortestPathALT(int startNumber, int destinationNumber) throws Exception { public Edge getShortestPathALT(int startNumber, int destinationNumber) throws Exception {
PriorityQueue<Edge> priorityQueue = new PriorityQueue<>(new Comparators.AltComparator(Utils.fileToArray("testOslo.txt",adjacencyList.size()),3430400)); PriorityQueue<Edge> priorityQueue = new PriorityQueue<>(new Comparators.AltComparator(Utils.fileToArray("testOsloNew.txt",adjacencyList.size()),3430400));
int nodeSize = adjacencyList.size(); int nodeSize = adjacencyList.size();
int[] pathWeight = new int[nodeSize]; int[] pathWeight = new int[nodeSize];
Arrays.fill(pathWeight, Integer.MAX_VALUE); Arrays.fill(pathWeight, Integer.MAX_VALUE);
......
...@@ -6,21 +6,13 @@ public class Main { ...@@ -6,21 +6,13 @@ public class Main {
try { try {
Graph g = new Graph("noder.txt"); Graph g = new Graph("noder.txt");
g.loadEdges("kanter.txt"); g.loadEdges("kanter.txt");
g.loadNodes("nodes.txt"); Edge lastEdge= g.getShortestPathALT(4247796,232073);
Edge lastEdge= g.getShortestPath(4247796,232073);
int sum = 0; int sum = 0;
List<Integer> destinations = new ArrayList<>();
while (lastEdge!=null) { while (lastEdge!=null) {
destinations.add(lastEdge.getDestination()); System.out.println(lastEdge.getDestination());
sum += lastEdge.drivingTime; sum += lastEdge.drivingTime;
lastEdge = lastEdge.previousEdge; lastEdge = lastEdge.previousEdge;
} }
List<Node> nodes = g.getNodes();
for (Integer destination: destinations) {
Node node = nodes.get(destination);
System.out.println(node.getLatitude() +","+node.getLongitude());
}
System.out.println(nodes.get(4247796).getLatitude()+","+nodes.get(4247796).getLongitude());
System.out.println(4247796); System.out.println(4247796);
System.out.println("-------------------------------------------"); System.out.println("-------------------------------------------");
System.out.println(Utils.formatTime(sum)); System.out.println(Utils.formatTime(sum));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment