本文整理匯總了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