forked from lebotlan/BE-Graphes
DONE Dijsktra
This commit is contained in:
parent
fa87e8d63b
commit
d53cc298d9
1 changed files with 2 additions and 3 deletions
|
|
@ -39,7 +39,6 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
|
||||||
Label destinationNodeLabel = labelsList.get(data.getDestination().getId());
|
Label destinationNodeLabel = labelsList.get(data.getDestination().getId());
|
||||||
Label concurentNodeLabel = labelsList.get(data.getOrigin().getId());
|
Label concurentNodeLabel = labelsList.get(data.getOrigin().getId());
|
||||||
concurentNodeLabel.setCoutRealise(0);
|
concurentNodeLabel.setCoutRealise(0);
|
||||||
concurentNodeLabel.setMarque();
|
|
||||||
|
|
||||||
notifyOriginProcessed(data.getOrigin());
|
notifyOriginProcessed(data.getOrigin());
|
||||||
|
|
||||||
|
|
@ -72,11 +71,11 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
|
||||||
ArrayList<Arc> pathArcs = new ArrayList<Arc>();
|
ArrayList<Arc> pathArcs = new ArrayList<Arc>();
|
||||||
concurentNodeLabel = destinationNodeLabel;
|
concurentNodeLabel = destinationNodeLabel;
|
||||||
while(concurentNodeLabel.getPere() != null) {
|
while(concurentNodeLabel.getPere() != null) {
|
||||||
pathArcs.add(concurentNodeLabel.getPere());
|
pathArcs.add(0, concurentNodeLabel.getPere());
|
||||||
concurentNodeLabel = labelsList.get(concurentNodeLabel.getPere().getOrigin().getId());
|
concurentNodeLabel = labelsList.get(concurentNodeLabel.getPere().getOrigin().getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
Collections.reverse(pathArcs);
|
// Collections.reverse(pathArcs);
|
||||||
|
|
||||||
solution = new ShortestPathSolution(data, Status.OPTIMAL, new Path(graph, pathArcs));
|
solution = new ShortestPathSolution(data, Status.OPTIMAL, new Path(graph, pathArcs));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue