is_arborescence#
- is_arborescence(G)[源]#
如果
G
是一个有向树(arborescence),则返回 True。有向树(arborescence)是最大入度等于 1 的有向树。
- 参数:
- G图
待测试的图。
- 返回:
- b布尔值
如果
G
是一个有向树,则为 True 的布尔值。
另请参阅
注释
在另一种约定中,有向树(arborescence)被称为树。
示例
>>> G = nx.DiGraph([(0, 1), (0, 2), (2, 3), (3, 4)]) >>> nx.is_arborescence(G) True >>> G.remove_edge(0, 1) >>> G.add_edge(1, 2) # maximum in-degree is 2 >>> nx.is_arborescence(G) False ----
其他后端也实现了此函数
cugraph : GPU 加速的后端。