mirror of
https://codeberg.org/qg-info-unterricht/zpg-graphentester.git
synced 2026-03-25 04:58:24 +01:00
Sync with upstream
This commit is contained in:
parent
39a2f13410
commit
66e8fa72bf
135 changed files with 38902 additions and 37757 deletions
|
|
@ -22,6 +22,13 @@ public class GraphAlgo_Dijkstra extends GraphAlgo {
|
|||
return "Kürzester Pfad (Dijkstra)";
|
||||
}
|
||||
|
||||
public void init() {
|
||||
super.init();
|
||||
for(Knoten k : g.getAlleKnoten()) {
|
||||
k.setWert(Double.POSITIVE_INFINITY);
|
||||
}
|
||||
info("Setze alle Entfernungen auf unendlich");
|
||||
}
|
||||
// Anfang Methoden
|
||||
|
||||
public void fuehreAlgorithmusAus() {
|
||||
|
|
@ -50,13 +57,10 @@ public class GraphAlgo_Dijkstra extends GraphAlgo {
|
|||
if(!n.isMarkiert()){
|
||||
info("- ist noch nicht markiert");
|
||||
Kante ka = g.getKante(k, n);
|
||||
if(!n.isBesucht() || n.getDoubleWert() > k.getDoubleWert()+ka.getGewicht()){
|
||||
if(n.getDoubleWert() > k.getDoubleWert()+ka.getGewicht()){
|
||||
if(n.isBesucht()) {
|
||||
List<Kante> eingehend = g.getEingehendeKanten(n, ka2 -> !ka2.isGeloescht() && ka2.isMarkiert());
|
||||
Kante alterWeg = eingehend.get(0);
|
||||
// Kante alterWeg = g.beschraenkeKantenAuf(g.getEingehendeKanten(n), Graph.MARKIERT, Graph.NICHTGELOESCHT).get(0);
|
||||
// alterWeg.setGeloescht(true);
|
||||
// alterWeg.setMarkiert(false);
|
||||
alterWeg.setGeloescht(true);
|
||||
alterWeg.setMarkiert(false);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue