avance Dijkstra
This commit is contained in:
parent
6993453b31
commit
98400e14f9
1 changed files with 31 additions and 1 deletions
|
|
@ -1,6 +1,13 @@
|
||||||
package org.insa.graphs.algorithm.shortestpath;
|
package org.insa.graphs.algorithm.shortestpath;
|
||||||
|
|
||||||
import java.util.org.insa.graphs.algorithm.shortestpath.label;
|
import java.util.org.insa.graphs.algorithm.shortestpath.Label;
|
||||||
|
|
||||||
|
import org.insa.graphs.algorithm.AbstractSolution.Status;
|
||||||
|
import org.insa.graphs.algorithm.utils.BinaryHeap;
|
||||||
|
import org.insa.graphs.model.Arc;
|
||||||
|
import org.insa.graphs.model.Graph;
|
||||||
|
import org.insa.graphs.model.Node;
|
||||||
|
import org.insa.graphs.model.Path;
|
||||||
|
|
||||||
|
|
||||||
public class DijkstraAlgorithm extends ShortestPathAlgorithm {
|
public class DijkstraAlgorithm extends ShortestPathAlgorithm {
|
||||||
|
|
@ -36,6 +43,29 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
|
||||||
Node nodeOriginel=data.getOrigin();
|
Node nodeOriginel=data.getOrigin();
|
||||||
Node nodeDestination=data.getDestination();
|
Node nodeDestination=data.getDestination();
|
||||||
|
|
||||||
|
BinaryHeap<Arc> leTas=new BinaryHeap<Arc>;
|
||||||
|
|
||||||
|
List<Arc> listeSuccesseurs;
|
||||||
|
|
||||||
|
|
||||||
|
//chercher les successeurs de l'origine
|
||||||
|
if (nodeOriginel.hasSuccessors()){
|
||||||
|
listeSuccesseurs=nodeOriginel.getSuccessors();
|
||||||
|
}else {
|
||||||
|
System.out.println("Le node originel n'a pas de successeurs \n");
|
||||||
|
}
|
||||||
|
|
||||||
|
//les mettre ds le tas
|
||||||
|
for(Arc arcActuel : listeSuccesseurs){
|
||||||
|
leTas.insert(arcActuel);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue