DirectedGraphPathCheck { public static boolean pathCheckBFS(GraphNode<Integer> p, GraphNode<Integer> q){ boolean isFound =false; p.restoreVisited(); isFound |= pathOrderCheckBFS(p, q); q.restoreVisited(); isFound |= pathOrderCheckBFS(q, p); return isFound; }  static boolean pathCheckDFS(GraphNode<Integer> p, GraphNode<Integer> q); static boolean pathCheckBFS(GraphNode<Integer> p, GraphNode<Integer> q);  }
@Test public void testPathCheckBFS(){ Assert.assertTrue(DirectedGraphPathCheck.pathCheckBFS(node1, node9)); Assert.assertTrue(DirectedGraphPathCheck.pathCheckBFS(node4, node4)); Assert.assertTrue(DirectedGraphPathCheck.pathCheckBFS(node4, node8)); Assert.assertTrue(DirectedGraphPathCheck.pathCheckBFS(node4, node9)); Assert.assertTrue(DirectedGraphPathCheck.pathCheckBFS(node9, node4)); Assert.assertFalse(DirectedGraphPathCheck.pathCheckBFS(node3, node4)); Assert.assertFalse(DirectedGraphPathCheck.pathCheckBFS(node6, node4)); }