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