File tree 2 files changed +3
-3
lines changed
src/com/jwetherell/algorithms/graph
test/com/jwetherell/algorithms/graph/test
2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change 15
15
public class BreadthFirstTraversal {
16
16
17
17
@ SuppressWarnings ("unchecked" )
18
- public static final <T extends Comparable <T >> Graph .Vertex <T >[] depthFirstTraversal (Graph <T > graph , Graph .Vertex <T > source ) {
18
+ public static final <T extends Comparable <T >> Graph .Vertex <T >[] breadthFirstTraversal (Graph <T > graph , Graph .Vertex <T > source ) {
19
19
// use for look-up via index
20
20
final ArrayList <Vertex <T >> vertices = new ArrayList <Vertex <T >>();
21
21
vertices .addAll (graph .getVertices ());
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ public class BreadthFirstTraversalTest {
38
38
39
39
@ Test
40
40
public void test1 () {
41
- final Graph .Vertex <Integer >[] result = BreadthFirstTraversal .depthFirstTraversal (graph , v2 );
41
+ final Graph .Vertex <Integer >[] result = BreadthFirstTraversal .breadthFirstTraversal (graph , v2 );
42
42
Assert .assertTrue (result [0 ].getValue ()==2 );
43
43
Assert .assertTrue (result [1 ].getValue ()==0 );
44
44
Assert .assertTrue (result [2 ].getValue ()==3 );
@@ -47,7 +47,7 @@ public void test1() {
47
47
48
48
@ Test
49
49
public void test2 () {
50
- final Graph .Vertex <Integer >[] result = BreadthFirstTraversal .depthFirstTraversal (graph , v0 );
50
+ final Graph .Vertex <Integer >[] result = BreadthFirstTraversal .breadthFirstTraversal (graph , v0 );
51
51
Assert .assertTrue (result [0 ].getValue ()==0 );
52
52
Assert .assertTrue (result [1 ].getValue ()==1 );
53
53
Assert .assertTrue (result [2 ].getValue ()==2 );
You can’t perform that action at this time.
0 commit comments