本文整理汇总了Python中networkx.classes.digraph.DiGraph.node[10]['r']方法的典型用法代码示例。如果您正苦于以下问题:Python DiGraph.node[10]['r']方法的具体用法?Python DiGraph.node[10]['r']怎么用?Python DiGraph.node[10]['r']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类networkx.classes.digraph.DiGraph
的用法示例。
在下文中一共展示了DiGraph.node[10]['r']方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_example_4
# 需要导入模块: from networkx.classes.digraph import DiGraph [as 别名]
# 或者: from networkx.classes.digraph.DiGraph import node[10]['r'] [as 别名]
def get_example_4():
g = DiGraph()
g.add_edges_from([(0, 1), (1, 2), (2, 3), (2, 14), # tree 1
(2, 15), (3, 16), (3, 17),
(0, 4), (4, 5), (4, 6), # tree 2
(5, 11), (6, 11), (6, 12), (6, 13),
(0, 7), (7, 8), (7, 9), # tree 3
(8, 10), (8, 11), (9, 12), (9, 13)])
for s, t in g.edges():
g[s][t]['c'] = 1
for n in g.nodes():
g.node[n]['r'] = 1
g.node[10]['r'] = 2
U = [7]
expected_edge_set = [
[(0, 7), (7, 8), (7, 9), # tree 3
(8, 10), (8, 11), (9, 12), (9, 13)]
]
return (g, U, expected_edge_set)