Пример #1
0
    def test_is_connected_graph(self):
        g = SimpleGraph(4)
        g.connect(1, 2)
        g.connect(3, 4)
        assert not g.is_connected_graph()

        g.connect(2, 3)
        assert g.is_connected_graph()
Пример #2
0
    def test_connect(self):
        g = SimpleGraph(8)
        n1 = 1
        n2 = 2

        g.connect(n1, n2)
        assert g.is_connected(n1, n2)
        assert g.is_connected(n2, n1)

        g.disconnect(n1, n2)
        assert not g.is_connected(n1, n2)
        assert not g.is_connected(n2, n1)