我正在尝试在一个非常大的图(DiGraph)上运行 NetworkX 的 pagerank,但我总是遇到这个错误:
Traceback (most recent call last):
File "summarize.py", line 120, in <module>
s = summerizer().summ(q)
File "summarize.py", line 108, in summ
rank = nx.pagerank(self.G, 0.9, vector)
File "/usr/local/lib/python2.7/dist-packages/networkx/algorithms/link_analysis/pagerank_alg.py", line 93, in pagerank
W=nx.stochastic_graph(D, weight=weight)
File "/usr/local/lib/python2.7/dist-packages/networkx/generators/stochastic.py", line 42, in stochastic_graph
d[weight]=d.get(weight,1.0)/degree[u]
ZeroDivisionError: integer division or modulo by zero
我尝试删除所有度数为零的节点,但仍然出现相同的错误。