betweenness with python-igraph and networkx
我有一个包含25万个节点和100万个边的大型图形,以计算其顶点之间的间隔(不计任何权重)。我的目标是使用python-igraph完成这项工作,因为它支持与其他软件包的并行计算。当我在具有100个顶点的相对较小的晶格上比较python-igarph和networkx的结果时(见图)。我发现它们完全不同。即使对于具有9个节点的晶格,igraph的结果全为0,而networkx的结果似乎是正确的。谁能帮我解决python-igraph这个问题?
这是代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 | from igraph import * import networkx as nx print("\\tUse python-igraph with Vertices=100") ig = Graph.Lattice([10, 10], 4, False, False, False) bt1 = ig.betweenness(directed=False, cutoff=None,nobigint=False) print("\\tBetweenness of python-igraph:") print(bt1) print("\\tUse networkx with Vertices=100") G_la= nx.grid_2d_graph(10,10,periodic=False) bt2 = nx.betweenness_centrality(G_la) print("\\tBetweenness of networkx:") print (bt2) |
在此处输入图像描述在此处输入图像描述
根据我对igraph Lattice函数文档的阅读,作为参数的数字
为清楚起见,networkx会将节点