本文整理汇总了Python中openalea.workflow.port_graph.PortGraph.nb_vertices方法的典型用法代码示例。如果您正苦于以下问题:Python PortGraph.nb_vertices方法的具体用法?Python PortGraph.nb_vertices怎么用?Python PortGraph.nb_vertices使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openalea.workflow.port_graph.PortGraph
的用法示例。
在下文中一共展示了PortGraph.nb_vertices方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_portgraph_add_vertex
# 需要导入模块: from openalea.workflow.port_graph import PortGraph [as 别名]
# 或者: from openalea.workflow.port_graph.PortGraph import nb_vertices [as 别名]
def test_portgraph_add_vertex():
pg = PortGraph()
vid = pg.add_vertex()
assert pg.nb_vertices() == 1
assert_raises(InvalidVertex, lambda: pg.add_vertex(vid))
assert len(tuple(pg.ports(vid))) == 0
assert pg.actor(vid) is None
示例2: test_portgraph_clear
# 需要导入模块: from openalea.workflow.port_graph import PortGraph [as 别名]
# 或者: from openalea.workflow.port_graph.PortGraph import nb_vertices [as 别名]
def test_portgraph_clear():
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)
pg.clear()
assert pg.nb_vertices() == 0
assert pg.nb_edges() == 0
assert len(tuple(pg.ports())) == 0
示例3: test_portgraph_init
# 需要导入模块: from openalea.workflow.port_graph import PortGraph [as 别名]
# 或者: from openalea.workflow.port_graph.PortGraph import nb_vertices [as 别名]
def test_portgraph_init():
pg = PortGraph()
assert pg.nb_vertices() == 0
assert pg.nb_edges() == 0