This commit is contained in:
Lea Norgeux 2023-04-05 15:38:56 +02:00
parent e537dfa8c0
commit 2b4e645c77
2 changed files with 42 additions and 2 deletions

View file

@ -1,5 +1,10 @@
package org.insa.graphs.algorithm.shortestpath;
import org.insa.graphs.algorithm.utils.BinaryHeap;
import java.util.ArrayList ;
import org.insa.graphs.model.Node;
import org.insa.graphs.model.Arc;
public class DijkstraAlgorithm extends ShortestPathAlgorithm {
public DijkstraAlgorithm(ShortestPathData data) {
@ -10,7 +15,42 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
protected ShortestPathSolution doRun() {
final ShortestPathData data = getInputData();
ShortestPathSolution solution = null;
// TODO:
int i ;
/* Taille du graphe */
int tailleGraphe = data.getGraph().size() ;
/* Tableau contenant tous les labels */
ArrayList<Label> labelSommets = new ArrayList<Label>() ;
/* Déclaration du label */
Label currentLabel ;
/* Déclaration du tas */
BinaryHeap<Integer> leTas = new BinaryHeap<Integer>() ;
/* Compte le nombre de sommets marqués */
int nbrMarques = 0 ;
int x ;
for(i=0;i<tailleGraphe;i++) {
/* Initialisation */
currentLabel = new Label(data.getGraph().get(i)) ;
labelSommets.set(i, currentLabel) ; //On met notre label dans le tableau dédié
}
leTas.insert(data.getOrigin().)
while (currentLabel.marque = false) {
x = leTas.deleteMin() ;
for (Arc arc : data.getGraph().getNodes()) {
currentLabel = new Label(node) ;
}
}
return solution;
}

View file

@ -27,7 +27,7 @@ public class Label {
this.sommetCourant = sommetCourant ;
this.marque = false ;
this.coutRealise = -1.0 ; //infini
this.pere = null ;
this.pere = null ; //sommet inexistant
}
/* METHODES */