示例#1
0
 def test_number_weakly_connected_big(self):
     G = retworkx.PyDAG()
     for i in range(100000):
         node = G.add_node(i)
         G.add_child(node, str(i), {})
     self.assertEqual(retworkx.number_weakly_connected_components(G),
                      100000)
示例#2
0
 def test_number_weakly_connected(self):
     G = retworkx.PyDAG()
     node_a = G.add_node(1)
     G.add_child(node_a, 2, {})
     G.add_node(3)
     self.assertEqual(retworkx.number_weakly_connected_components(G), 2)
示例#3
0
 def test_number_weakly_connected_node_holes(self):
     graph = retworkx.PyDiGraph()
     graph.add_nodes_from([0, 1, 2])
     graph.remove_node(1)
     self.assertEqual(retworkx.number_weakly_connected_components(graph), 2)
示例#4
0
 def test_number_weakly_connected_all_strong(self):
     G = retworkx.PyDAG()
     node_a = G.add_node(1)
     node_b = G.add_child(node_a, 2, {})
     G.add_child(node_b, 3, {})
     self.assertEqual(retworkx.number_weakly_connected_components(G), 1)
示例#5
0
 def time_number_weakly_connected_components(self):
     retworkx.number_weakly_connected_components(self.graph)