From 23be38ee2b21a3241379d7d8d0c2f83d0744023b Mon Sep 17 00:00:00 2001 From: moll Date: Wed, 6 May 2026 16:37:34 +0200 Subject: [PATCH] Update Dijkstra (all notify working) --- .../graphs/algorithm/shortestpath/DijkstraAlgorithm.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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);