From 432bf1bb9605be26e8e423a8a947b9439c543c3e Mon Sep 17 00:00:00 2001 From: Benmouffok Helwen Date: Sun, 7 Jun 2026 21:24:50 +0200 Subject: [PATCH] =?UTF-8?q?leg=C3=A8res=20modifications=20pour=20afficher?= =?UTF-8?q?=20le=20nombre=20de=20sommet=20explor=C3=A9s=20et=20marqu=C3=A9?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../algorithm/shortestpath/DijkstraAlgorithm.java | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 fa6293b..8f0c026 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 @@ -40,9 +40,15 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm { labels[data.getOrigin().getId()].setCoutRealise(0); notifyOriginProcessed(data.getOrigin()); tas.insert(labels[data.getOrigin().getId()]); + + // Compteurs de performance + int labelsExplores = 0; // inseres dans le tas + int labelsMarques = 0; // definitvement traites + while (!tas.isEmpty()) { Label labelMin = tas.deleteMin(); labelMin.setMarque(); + labelsMarques++; // incremente apres chaque marquage notifyNodeMarked(labelMin.getSommetCourant()); if (labelMin.getSommetCourant().equals(data.getDestination())) { break; @@ -59,6 +65,7 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm { tas.remove(labelSucc); } else { notifyNodeReached(arc.getDestination()); + labelsExplores++; // incremente quand on atteint un nouveau sommet } labelSucc.setCoutRealise(nouveauCout); labelSucc.setPere(arc); @@ -67,6 +74,10 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm { } } } + + System.out.println("Labels explores : " + labelsExplores); + System.out.println("Labels marques : " + labelsMarques); + // Construction de la solution if (labels[data.getDestination().getId()].getPere() == null) { solution = new ShortestPathSolution(data, Status.INFEASIBLE);