예제 #1
0
    def is_connected(self):
        """
        Test if the graph is connected.

        Return True if connected, False otherwise
        """
        try:
            return rx.is_weakly_connected(self.graph)
        except rx.NullGraph:
            return False
예제 #2
0
 def test_is_weakly_connected_true(self):
     graph = retworkx.PyDiGraph()
     graph.extend_from_edge_list([
         (0, 1),
         (1, 2),
         (2, 3),
         (3, 0),
         (2, 4),
         (4, 5),
         (5, 6),
         (6, 7),
         (7, 4),
     ])
     self.assertTrue(retworkx.is_weakly_connected(graph))
예제 #3
0
 def test_is_weakly_connected_null_graph(self):
     graph = retworkx.PyDiGraph()
     with self.assertRaises(retworkx.NullGraph):
         retworkx.is_weakly_connected(graph)