ajout de setters pour Label et debut de Dijkstra

This commit is contained in:
knzrd 2025-05-21 15:07:49 +02:00
parent 67d0edeb0d
commit fefe2d3a62
2 changed files with 26 additions and 5 deletions

View file

@ -1,11 +1,7 @@
package org.insa.graphs.algorithm.shortestpath; package org.insa.graphs.algorithm.shortestpath;
import org.insa.graphs.algorithm.AbstractInputData;
import org.insa.graphs.algorithm.utils.BinaryHeap;
import org.insa.graphs.model.Graph; import org.insa.graphs.model.Graph;
import org.insa.graphs.model.Node; import org.insa.graphs.model.Node;
import org.insa.graphs.model.Arc;
import org.insa.graphs.model.Path;
public class DijkstraAlgorithm extends ShortestPathAlgorithm { public class DijkstraAlgorithm extends ShortestPathAlgorithm {
@ -31,7 +27,13 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
ShortestPathSolution solution = null; ShortestPathSolution solution = null;
// TODO: implement the Dijkstra algorithm // TODO: implement the Dijkstra algorithm
// On crée un tableau de label avec un label pour chacun des noeuds :de 0 à N-1
Label tableau_label[] = new Label[nbNodes] ;
// on commence par mettre tous les label à +inf (soit ici la plus grande valeur possible)
for (int i=0;i<nbNodes;i++) {
}
// On met la valeur du label de l'origine à 0
// when the algorithm terminates, return the solution that has been found // when the algorithm terminates, return the solution that has been found
return solution; return solution;
} }

View file

@ -15,6 +15,25 @@ public class Label {
// arc correspondant au chemin (le plus court car on peut avoir plusieurs arcs) du père vers le sommet courant // arc correspondant au chemin (le plus court car on peut avoir plusieurs arcs) du père vers le sommet courant
private Arc arcpere_fils; private Arc arcpere_fils;
//setter sommet courant
public void setsommetcourant (int sommet_courant) {
this.sommet_courant = sommet_courant;
}
//setter marque
public void setmarque (boolean marque) {
this.marque = marque;
}
//setter cout_realise
public void setcoutrealise(int cout_realise) {
this.cout_realise = cout_realise;
}
//setter arcpere_fils
public void setarcperefils (Arc arcpere_fils) {
this.arcpere_fils = arcpere_fils;
}
//getter sommet courant //getter sommet courant
public int getsommetcourant () { public int getsommetcourant () {
return this.sommet_courant; return this.sommet_courant;
@ -25,7 +44,7 @@ public class Label {
return this.marque; return this.marque;
} }
//getter cout_realise a verifier si c'est la meme chose que cout_realisé //getter cout_realise (a verifier si c'est la meme chose que cout_realisé)
public int getCost() { public int getCost() {
return this.cout_realise; return this.cout_realise;
} }