DiGraph.pred#
- property DiGraph.pred#
图形邻接对象,包含每个节点的前置任务。
此对象是一个只读的类似dict的结构,具有节点键和相邻的dict值。邻居dict由边缘数据dict的邻居键入。
G.pred[2][3]['color'] = 'blue'
设置边缘的颜色(3, 2)
到"blue"
.在g.pred上迭代的行为类似于dict。有用的习语包括
for nbr, datadict in G.pred[n].items():
. dicts未提供的数据视图也存在:for nbr, foovalue in G.pred[node].data('foo'):
默认值可以通过default
论据data
方法。