From 460456581e21dea974945ac79c626cb9ae783ed2 Mon Sep 17 00:00:00 2001 From: Yohan Simard Date: Tue, 19 May 2020 18:35:58 +0200 Subject: [PATCH] Minor fixes and tests --- .../graphs/algorithm/shortestpath/DijkstraAlgorithm.java | 8 +++++++- .../graphs/algorithm/shortestpath/AStarAlgorithmTest.java | 2 +- .../algorithm/shortestpath/DijkstraAlgorithmTest.java | 2 +- .../graphs/algorithm/shortestpath/ShortestPathTest.java | 5 +++-- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/DijkstraAlgorithm.java b/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/DijkstraAlgorithm.java index 0cafc76..384cbc2 100644 --- a/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/DijkstraAlgorithm.java +++ b/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/DijkstraAlgorithm.java @@ -56,7 +56,10 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm { Node destination = data.getDestination(); Node currentNode = null; + + // Debug / Tests double previousCost = 0; + int iterationCounter = 0; while (!heap.isEmpty() && (currentNode == null || !currentNode.equals(destination))) { // Get the node with the minimum cost @@ -65,11 +68,12 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm { currentNode = currentLabel.getNode(); /* - // Debug + // Debug / Tests assert(((BinaryHeap