Exemplo n.º 1
0
 def test_add_edge_correct_duplicate(self):
     graph = Graph([(1, 2, 1)])  # One edge, two nodes
     graph.add_edge(1, 2, 1)  # Add a parallel edge
     self.assertEqual([(1, 2, 1), (1, 2, 1)], graph.all_edges)
Exemplo n.º 2
0
 def test_add_edge_correct_easy(self):
     graph = Graph([(1, 2, 1)])  # One edge, two nodes
     graph.add_edge(2, 3, 2)  # Add an edge from 2 to 3 w/ cost 2
     self.assertEqual([(1, 2, 1), (2, 3, 2)], graph.all_edges)