我有这个节点列表,我想得到最小路径,因为我有负权重的节点必须使用Bellman Ford,我正在使用networkx库,但是我没有得到打印路径的表单,这是有权重的节点列表和我正在使用的命令
1 10 {'weight': 96}
1 13 {'weight': 97}
2 11 {'weight': -70}
2 13 {'weight': 77}
3 12 {'weight': 30}
3 13 {'weight': -30}
4 10 {'weight': 17}
4 14 {'weight': -75}
5 11 {'weight': -4}
5 14 {'weight': 45}
6 12 {'weight': -67}
6 14 {'weight': 63}
7 10 {'weight': 38}
7 15 {'weight': -40}
8 11 {'weight': -30}
8 15 {'weight': -46}
9 12 {'weight': 37}
9 15 {'weight': -97}
assert_raises(nx.NetworkXUnbounded,nx.bellman_ford,G_Bellman_Ford,1)
图中G嫒Bellman_Ford是图
定义将返回前置任务转换为路径的函数
^{pr2}$相关问题 更多 >
编程相关推荐