Compare commits
2 commits
6baec1d7dd
...
224ab4a97d
| Author | SHA1 | Date | |
|---|---|---|---|
| 224ab4a97d | |||
| 5363dd1a89 |
1 changed files with 7 additions and 3 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue