forked from IF-LK-2020/breitensuche
findVertex() Um konsolenausgaben zur veranschaulichung erweitert
This commit is contained in:
Binary file not shown.
@@ -49,13 +49,14 @@ public class Breitensuche {
|
||||
// searchQueue ein und arbeite die Knoten in ihr der Reihe nach
|
||||
// ab, bis die Queue leer ist, oder der gesuchte Knoten
|
||||
// gefunden wurde.
|
||||
// TODO: Ergänze deine Methode um Ausgaben, anhand derer die Abarbeitung
|
||||
// Finished: Ergänze deine Methode um Ausgaben, anhand derer die Abarbeitung
|
||||
// deutlich wird.
|
||||
// TODO: Wenn dein Algorithmus funnktioniert, kopiere die Methode und
|
||||
// Erstelle Varianten, bei denen die Reihenfolge der Nachbarknoten
|
||||
// modifiziert ist. Dazu
|
||||
|
||||
if(g.getVertex("Köln").getID().equals(pVertexID)){
|
||||
System.out.println("Köln gefunden");
|
||||
return true;
|
||||
} else {
|
||||
g.getVertex("Köln").setMark(true);
|
||||
@@ -66,7 +67,9 @@ public class Breitensuche {
|
||||
ngbrs.toFirst();
|
||||
while(ngbrs.hasAccess()){
|
||||
if(!ngbrs.getContent().isMarked()){
|
||||
System.out.println(ngbrs.getContent().getID());
|
||||
if(ngbrs.getContent().getID().equals(pVertexID)){
|
||||
System.out.println(ngbrs.getContent().getID() +" gefunden");
|
||||
return true;
|
||||
}
|
||||
ngbrs.getContent().setMark(true);
|
||||
@@ -77,6 +80,7 @@ public class Breitensuche {
|
||||
searchQueue.dequeue();
|
||||
}
|
||||
}
|
||||
System.out.println(pVertexID +" Nicht gefunden");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
109
package.bluej
109
package.bluej
@@ -1,26 +1,50 @@
|
||||
#BlueJ package file
|
||||
dependency1.from=BinarySearchTree
|
||||
dependency1.to=ComparableContent
|
||||
dependency1.from=BreitensucheTest
|
||||
dependency1.to=Breitensuche
|
||||
dependency1.type=UsesDependency
|
||||
dependency2.from=Racingsimulator
|
||||
dependency2.to=Athlete
|
||||
dependency10.from=Breitensuche
|
||||
dependency10.to=List
|
||||
dependency10.type=UsesDependency
|
||||
dependency2.from=Graph
|
||||
dependency2.to=List
|
||||
dependency2.type=UsesDependency
|
||||
editor.fx.0.height=738
|
||||
editor.fx.0.width=816
|
||||
editor.fx.0.x=466
|
||||
editor.fx.0.y=146
|
||||
objectbench.height=100
|
||||
dependency3.from=Graph
|
||||
dependency3.to=Vertex
|
||||
dependency3.type=UsesDependency
|
||||
dependency4.from=Graph
|
||||
dependency4.to=Edge
|
||||
dependency4.type=UsesDependency
|
||||
dependency5.from=Edge
|
||||
dependency5.to=Vertex
|
||||
dependency5.type=UsesDependency
|
||||
dependency6.from=Breitensuche
|
||||
dependency6.to=Graph
|
||||
dependency6.type=UsesDependency
|
||||
dependency7.from=Breitensuche
|
||||
dependency7.to=Vertex
|
||||
dependency7.type=UsesDependency
|
||||
dependency8.from=Breitensuche
|
||||
dependency8.to=Edge
|
||||
dependency8.type=UsesDependency
|
||||
dependency9.from=Breitensuche
|
||||
dependency9.to=Queue
|
||||
dependency9.type=UsesDependency
|
||||
editor.fx.0.height=1416
|
||||
editor.fx.0.width=2576
|
||||
editor.fx.0.x=-8
|
||||
editor.fx.0.y=-8
|
||||
objectbench.height=130
|
||||
objectbench.width=1256
|
||||
package.divider.horizontal=0.6
|
||||
package.divider.vertical=0.881243063263041
|
||||
package.editor.height=787
|
||||
package.divider.vertical=0.8477777777777777
|
||||
package.editor.height=756
|
||||
package.editor.width=1145
|
||||
package.editor.x=0
|
||||
package.editor.y=0
|
||||
package.editor.x=17
|
||||
package.editor.y=171
|
||||
package.frame.height=1000
|
||||
package.frame.width=1296
|
||||
package.numDependencies=2
|
||||
package.numTargets=4
|
||||
package.numDependencies=10
|
||||
package.numTargets=7
|
||||
package.showExtends=true
|
||||
package.showUses=true
|
||||
project.charset=UTF-8
|
||||
@@ -30,30 +54,51 @@ readme.width=47
|
||||
readme.x=10
|
||||
readme.y=10
|
||||
target1.height=50
|
||||
target1.name=Racingsimulator
|
||||
target1.name=BreitensucheTest
|
||||
target1.showInterface=false
|
||||
target1.type=ClassTarget
|
||||
target1.type=UnitTestTargetJunit4
|
||||
target1.width=130
|
||||
target1.x=450
|
||||
target1.y=472
|
||||
target1.x=150
|
||||
target1.y=20
|
||||
target2.height=50
|
||||
target2.name=ComparableContent
|
||||
target2.name=Vertex
|
||||
target2.showInterface=false
|
||||
target2.type=InterfaceTarget
|
||||
target2.width=250
|
||||
target2.x=160
|
||||
target2.y=270
|
||||
target2.type=ClassTarget
|
||||
target2.width=80
|
||||
target2.x=70
|
||||
target2.y=70
|
||||
target3.height=50
|
||||
target3.name=Athlete
|
||||
target3.name=Graph
|
||||
target3.showInterface=false
|
||||
target3.type=ClassTarget
|
||||
target3.width=90
|
||||
target3.x=280
|
||||
target3.y=550
|
||||
target3.width=80
|
||||
target3.x=160
|
||||
target3.y=70
|
||||
target4.height=50
|
||||
target4.name=BinarySearchTree
|
||||
target4.name=Breitensuche
|
||||
target4.showInterface=false
|
||||
target4.type=ClassTarget
|
||||
target4.width=230
|
||||
target4.x=370
|
||||
target4.y=90
|
||||
target4.width=100
|
||||
target4.x=10
|
||||
target4.y=130
|
||||
target5.height=50
|
||||
target5.name=List
|
||||
target5.showInterface=false
|
||||
target5.type=ClassTarget
|
||||
target5.width=150
|
||||
target5.x=110
|
||||
target5.y=130
|
||||
target6.height=50
|
||||
target6.name=Edge
|
||||
target6.showInterface=false
|
||||
target6.type=ClassTarget
|
||||
target6.width=80
|
||||
target6.x=10
|
||||
target6.y=190
|
||||
target7.height=50
|
||||
target7.name=Queue
|
||||
target7.showInterface=false
|
||||
target7.type=ClassTarget
|
||||
target7.width=160
|
||||
target7.x=100
|
||||
target7.y=190
|
||||
|
||||
Reference in New Issue
Block a user