本文整理汇总了Python中openalea.workflow.port_graph.PortGraph.nb_neighbors方法的典型用法代码示例。如果您正苦于以下问题:Python PortGraph.nb_neighbors方法的具体用法?Python PortGraph.nb_neighbors怎么用?Python PortGraph.nb_neighbors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openalea.workflow.port_graph.PortGraph
的用法示例。
在下文中一共展示了PortGraph.nb_neighbors方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_portgraph_remove_vertex
# 需要导入模块: from openalea.workflow.port_graph import PortGraph [as 别名]
# 或者: from openalea.workflow.port_graph.PortGraph import nb_neighbors [as 别名]
def test_portgraph_remove_vertex():
pg = PortGraph()
vid1 = pg.add_vertex()
vid2 = pg.add_vertex()
pid1 = pg.add_in_port(vid1, "in")
pid2 = pg.add_out_port(vid2, "out")
pg.connect(pid2, pid1)
assert_raises(InvalidVertex, lambda: pg.remove_vertex(vid1 + vid2 + 1))
pg.remove_vertex(vid1)
assert tuple(pg.ports()) == (pid2,)
assert_raises(InvalidVertex, lambda: pg.ports(vid1).next())
assert tuple(pg.ports(vid2)) == (pid2,)
assert pg.nb_connections(pid2) == 0
assert pg.nb_neighbors(vid2) == 0