ajout de tas.isValid et vérifications (sans junit)
This commit is contained in:
parent
31de9cb5f5
commit
ce16e03284
2 changed files with 19 additions and 1 deletions
|
@ -44,12 +44,15 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
|
|||
|
||||
tablabel[x].marque=true;
|
||||
this.notifyNodeMarked(tablabel[x].sommet_courant);
|
||||
//System.out.printf("%f\n",tablabel[x].cout);
|
||||
//System.out.printf("%d\n",tablabel[x].sommet_courant.getNumberOfSuccessors());
|
||||
nomark--;
|
||||
int y;
|
||||
|
||||
for (Arc arcy: tablabel[x].sommet_courant.getSuccessors()) {
|
||||
|
||||
y=arcy.getDestination().getId();
|
||||
//System.out.println(tas.isValid());
|
||||
|
||||
if (!tablabel[y].marque && data.isAllowed(arcy)) {//ligne 108 de l'excel d'avancement
|
||||
|
||||
|
|
|
@ -208,5 +208,20 @@ public class BinaryHeap<E extends Comparable<E>> implements PriorityQueue<E> {
|
|||
public String toString() {
|
||||
return BinaryHeapFormatter.toStringTree(this, 8);
|
||||
}
|
||||
|
||||
|
||||
public boolean isValid() {//utilisé pour la vérification du Dijkstra
|
||||
boolean reponse=true;
|
||||
if (this.isEmpty()) {
|
||||
BinaryHeap<E> copie=new BinaryHeap<E>(this);
|
||||
E prec=null;
|
||||
E nouv=null;
|
||||
while (!copie.isEmpty() && reponse) {
|
||||
nouv=this.deleteMin();
|
||||
if (prec.compareTo(nouv)>0)
|
||||
reponse=false;
|
||||
prec=nouv;
|
||||
}
|
||||
}
|
||||
return reponse;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue