1
0
Fork 0

Update Dijkstra (all notify working)

This commit is contained in:
Sebastien Moll 2026-05-06 16:37:34 +02:00
parent e249625793
commit 23be38ee2b

View file

@ -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);