dijkstra
This commit is contained in:
parent
14240bbf30
commit
4e6a6cbcd3
1 changed files with 1 additions and 3 deletions
|
@ -1,8 +1,6 @@
|
||||||
package org.insa.graphs.algorithm.shortestpath;
|
package org.insa.graphs.algorithm.shortestpath;
|
||||||
import org.insa.graphs.model.Node;
|
|
||||||
import org.insa.graphs.model.Arc;
|
import org.insa.graphs.model.Arc;
|
||||||
import org.insa.graphs.algorithm.AbstractSolution.Status;
|
import org.insa.graphs.algorithm.AbstractSolution.Status;
|
||||||
import org.insa.graphs.model.Graph;
|
|
||||||
|
|
||||||
import org.insa.graphs.model.Path;
|
import org.insa.graphs.model.Path;
|
||||||
|
|
||||||
|
@ -51,6 +49,7 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
|
||||||
System.out.println("l'élement n'est pas dans la tas");
|
System.out.println("l'élement n'est pas dans la tas");
|
||||||
}
|
}
|
||||||
tab.get(index).setCoutmin(x.getCost()+suc.getLength());
|
tab.get(index).setCoutmin(x.getCost()+suc.getLength());
|
||||||
|
tab.get(index).setPere(suc);
|
||||||
/*insertion dans le tas */
|
/*insertion dans le tas */
|
||||||
tas.insert(tab.get(index));
|
tas.insert(tab.get(index));
|
||||||
}
|
}
|
||||||
|
@ -67,7 +66,6 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
|
||||||
// The destination has been found, notify the observers.
|
// The destination has been found, notify the observers.
|
||||||
notifyDestinationReached(data.getDestination());
|
notifyDestinationReached(data.getDestination());
|
||||||
|
|
||||||
// Create the path from the array of predecessors...
|
|
||||||
ArrayList<Arc> arcs = new ArrayList<>();
|
ArrayList<Arc> arcs = new ArrayList<>();
|
||||||
Arc arc = label_dest.getPere();
|
Arc arc = label_dest.getPere();
|
||||||
while (arc != null) {
|
while (arc != null) {
|
||||||
|
|
Loading…
Reference in a new issue