我正在测试Networkx和Igraph的最小割函数,但是我遇到了这样的情况:在给定完全相同的图表的情况下,它们为各自的mincut函数返回不同的值。
G = nx.Graph()
graph = ig.Graph()
#LINES[1 - 3] are just src dest weights from a file. I did not include the parsing code for clarity purposes.
G.add_edge(lines[1], lines[2], weight=int(lines[3]))
graph.add_vertex(lines[1])
graph.add_vertex(lines[2])
graph.add_edge(lines[1], lines[2], weight=int(lines[3]), capacity=int(lines[3]))
ans = nx.stoer_wagner(G)
print("MinCut Val: ", ans[0])
print(graph.mincut())
我的命令行输出如下:
MinCut Val: 744
Graph cut (0 edges, 1024 vs 31232 vertices, value=0.0000)
是否存在差异的原因?一个的mincut怎么可能是0,另一个的mincut怎么可能是744?
谢谢!