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 d144907..6e2fb21 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 @@ -48,7 +48,7 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm { while (!found && !labelsHeap.isEmpty()) { concurentNodeLabel = labelsHeap.deleteMin(); if (!concurentNodeLabel.getMarque()) { - notifyNodeReached(concurentNodeLabel.getSommetCourant()); + notifyNodeMarked(concurentNodeLabel.getSommetCourant()); concurentNodeLabel.setMarque(); for (Arc arc : concurentNodeLabel.getSommetCourant().getSuccessors()) { @@ -59,6 +59,9 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm { Label successorLabel = labelsList.get(arc.getDestination().getId()); Double newCost = data.getCost(arc) + concurentNodeLabel.getCost(); + if (successorLabel.getCost() == Double.POSITIVE_INFINITY) { + notifyNodeReached(arc.getDestination()); + } if (newCost < successorLabel.getCost()) { successorLabel.setPere(arc); successorLabel.setCoutRealise(newCost);