コード例 #1
0
 def test_is_bridge_false(self):
     #  Two triangles 1-2-3 and 4-5-6 joined by '3-4' bridge
     graph = Graph([(1, 2, 1), (1, 3, 1), (2, 3, 1), (3, 4, 1), (4, 5, 1),
                    (4, 6, 1), (5, 6, 1)])
     self.assertFalse(
         graph.is_bridge(2))  # Edge 2 aka '2-3' is not a bridge
コード例 #2
0
 def test_is_bridge_true(self):
     #  Two triangles joined by 'CD'
     graph = Graph([(1, 2, 1), (1, 3, 1), (2, 3, 1), (3, 4, 1), (4, 5, 1),
                    (4, 6, 1), (5, 6, 1)])
     self.assertTrue(graph.is_bridge((3, 4, 1)))
コード例 #3
0
 def test_is_bridge_true(self):
     #  Two triangles 1-2-3 and 4-5-6 joined by '3-4' bridge
     graph = Graph([(1, 2, 1), (1, 3, 1), (2, 3, 1), (3, 4, 1), (4, 5, 1),
                    (4, 6, 1), (5, 6, 1)])
     self.assertTrue(graph.is_bridge(3))  # Edge 3 aka '3-4 'is a bridge