diff --git a/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/Label.java b/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/Label.java new file mode 100644 index 0000000..04497b4 --- /dev/null +++ b/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/Label.java @@ -0,0 +1,39 @@ +package org.insa.graphs.algorithm.shortestpath; + +public class Label { + + /* sommet courant : sommet associé à ce label (sommet ou numéro de sommet). +marque : booléen, vrai lorsque le coût min de ce sommet est définitivement connu par l'algorithme. +coût réalisé : valeur courante du plus court chemin depuis l'origine vers le sommet. Pour éviter toute confusion plus tard, ne l'appelez pas simplement coût. +père : correspond au sommet précédent sur le chemin correspondant au plus court chemin courant. Afin de reconstruire le chemin à la fin de l'algorithme, mieux vaut stocker l'arc plutôt que seulement le père. +Ajoutez les getters. +Important pour la suite : une méthode getCost() qui renvoie le coût de ce label. Pour le moment, le coût est égal au coût réalisé. + */ +private int sommetCourant; +private Boolean marque; +private double coutRealise; +private Arc pere; + public Label(int sommetCourant,Boolean marque,double coutRealise, Arc pere){ + this.sommetCourant=sommetCourant; + this.marque=marque; + this.coutRealise=coutRealise; + this.pere=pere; + } + + public int getSommetCourant() { + return sommetCourant; + } + + public Boolean getMarque() { + return marque; + } + + public double getCoutRealise() { + return coutRealise; + } + + public double getCost(){ + return coutRealise; + } + +} diff --git a/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/utils/BinaryHeap.java b/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/utils/BinaryHeap.java index df29f3a..691ad5a 100644 --- a/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/utils/BinaryHeap.java +++ b/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/utils/BinaryHeap.java @@ -153,10 +153,11 @@ public class BinaryHeap> implements PriorityQueue { currentSize--; percolateDown(ind); percolateUp(ind); - } else { + } + else { currentSize--; } - + } @Override