Skip to content

Commit 2393b6e

Browse files
authored
Update BidirectionalBFSTest.java
1 parent 715fd1b commit 2393b6e

File tree

1 file changed

+8
-21
lines changed

1 file changed

+8
-21
lines changed
Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
1-
package com.thealgorithms.graphs;
2-
31
import java.util.Map;
42
import java.util.List;
53
import java.util.HashMap;
64
import java.util.Arrays;
75

8-
import org.junit.Test;
9-
import static org.junit.Assert.*;
10-
116
/**
12-
* Unit tests for BidirectionalBFS.
7+
* Simple test for BidirectionalBFS.
138
*/
149
public class BidirectionalBFSTest
1510
{
16-
@Test
17-
public void testPathExists()
11+
public static void main(String[] args)
1812
{
1913
Map<Integer, List<Integer>> graph = new HashMap<>();
2014
graph.put(0, Arrays.asList(1, 2));
@@ -24,19 +18,12 @@ public void testPathExists()
2418
graph.put(4, Arrays.asList(2, 5));
2519
graph.put(5, Arrays.asList(3, 4));
2620

27-
assertTrue(BidirectionalBFS.bidirectionalBFS(graph, 0, 5));
28-
}
21+
// Test 1
22+
boolean result1 = BidirectionalBFS.bidirectionalBFS(graph, 0, 5);
23+
System.out.println("Path 0->5 exists: " + result1); // true
2924

30-
@Test
31-
public void testPathDoesNotExist()
32-
{
33-
Map<Integer, List<Integer>> graph = new HashMap<>();
34-
graph.put(0, Arrays.asList(1));
35-
graph.put(1, Arrays.asList(0));
36-
// node 2 is isolated
37-
graph.put(2, Arrays.asList());
38-
39-
assertFalse(BidirectionalBFS.bidirectionalBFS(graph, 0, 2));
25+
// Test 2
26+
boolean result2 = BidirectionalBFS.bidirectionalBFS(graph, 0, 6);
27+
System.out.println("Path 0->6 exists: " + result2); // false
4028
}
4129
}
42-

0 commit comments

Comments
 (0)