Skip to content
Snippets Groups Projects
Commit 9beb0157 authored by Pedro Pablo Cardona Arroyave's avatar Pedro Pablo Cardona Arroyave
Browse files

Print latitud og longitud

parent c2713483
No related branches found
No related tags found
No related merge requests found
...@@ -9,11 +9,18 @@ public class Main { ...@@ -9,11 +9,18 @@ public class Main {
g.loadNodes("nodes.txt"); g.loadNodes("nodes.txt");
Edge lastEdge= g.getShortestPath(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());
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