Compare commits

...

2 commits

View file

@ -78,11 +78,15 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
// Si le noeud n'a pas déjà était rajouté au tas, on le rajoute
// isReached permet de vérifier en complexité O(1)
// C'est un léger coût en mémoire pour un gain en vitesse
if (!successor.isReached()) {
tas.insert(successor);
if (successor.isReached()) {
// removing then inserting resorts the binary heap
tas.remove(successor);
} else {
successor.markReached();
notifyNodeReached(successor.getNode());
}
tas.insert(successor);
}
}
}
@ -106,7 +110,7 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
// current node and add it to the path
if (parent_label != null) {
for (Arc arc : parent_label.getNode().getSuccessors()) {
if (arc.getDestination().getId() == current_label.getNode().getId()) {
if (arc.getDestination().getId() == current_label.getNode().getId() && data.isAllowed(arc)) {
arcs_path.add(arc);
break;
}