forked from lebotlan/BE-Graphes
Update Dijkstra (all notify working)
This commit is contained in:
parent
e249625793
commit
23be38ee2b
1 changed files with 4 additions and 1 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue