legères modifications pour afficher le nombre de sommet explorés et marqués

This commit is contained in:
Benmouffok Helwen 2026-06-07 21:24:50 +02:00
parent c9cb1ae65e
commit 432bf1bb96

View file

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