コード例 #1
0
 def test_add_edge(self):
     graph = Graph("my graph")
     graph.add_vertex("A")
     graph.add_vertex("B")
     graph.add_edge("A", "B")
     self.assertEqual(1, len(graph.edges()))
     graph.add_edge("X", "Y")
     self.assertEqual(2, len(graph.edges()))
     self.assertEqual(4, len(graph.vertices()))
コード例 #2
0
 def test_add_vertex(self):
     graph = Graph("my graph")
     graph.add_vertex("A")
     self.assertEqual(['A'], graph.vertices())