예제 #1
0
 def test_reachable_pair(self):
     """TestData for a reachable pair of nodes."""
     G = DiGraph([(0, 1), (1, 2), (2, 0)])
     assert is_reachable(G, 0, 2)
예제 #2
0
 def test_unreachable_pair(self):
     """TestData for an unreachable pair of nodes."""
     G = DiGraph([(0, 1), (0, 2), (1, 2)])
     assert not is_reachable(G, 1, 0)
예제 #3
0
 def test_same_node_is_reachable(self):
     """TestData that a node is always reachable from itself."""
     # G is an arbitrary tournament on ten nodes.
     G = DiGraph(sorted(p) for p in combinations(range(10), 2))
     assert all(is_reachable(G, v, v) for v in G)
 def test_unreachable_pair(self):
     """Tests for an unreachable pair of nodes."""
     G = DiGraph([(0, 1), (0, 2), (1, 2)])
     assert_false(is_reachable(G, 1, 0))
예제 #5
0
 def test_same_node_is_reachable(self):
     """Tests that a node is always reachable from itself."""
     # G is an arbitrary tournament on ten nodes.
     G = DiGraph(sorted(p) for p in combinations(range(10), 2))
     assert_true(all(is_reachable(G, v, v) for v in G))
예제 #6
0
 def test_reachable_pair(self):
     """Tests for a reachable pair of nodes."""
     G = DiGraph([(0, 1), (1, 2), (2, 0)])
     assert_true(is_reachable(G, 0, 2))