def test_has_cycle_implicit():
"""A Vertex is accessible to the Graph but not explicitly part of it."""
a = Vertex(Vertex._make_test_vertex())
b = Vertex(Vertex._make_test_vertex())
c = Vertex(Vertex._make_test_vertex())
a.add_edge(Edge(b))
b.add_edge(Edge(c))
c.add_edge(Edge(a))
g = Graph([a, b])
assert g.has_cycle()
评论列表
文章目录