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 47c7b0f..785ed6c 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 @@ -73,6 +73,7 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm { // This loop serves to get the length of the arc as // we know its origin and destination for (Arc arc : x.getNode().getSuccessors()) { + if (successor.getNode().equals(arc.getDestination())) { // data.getcost(arc) returns a cost considering the mode chosen: // TIME or LENGTH @@ -82,7 +83,7 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm { } final float possible_path_cost = x.getCost() + arc_cost; - if (successor.getCost() >= possible_path_cost) { + if (successor.getCost() > possible_path_cost) { // Mise à jour du label successor.setPathCost(possible_path_cost); successor.setParentNode(x.getNode());