2013-03-04 2 views
0

내가 다음과 같이 내가이 networkx의 작은 코드를 작성했습니다 여러 가장자리가 그래프에서 히트 수를 계산하려고 : 내가하려고 할 때안타 계산 networkx

import networkx as nx 
import matplotlib.pylab as plot 
g=nx.read_pajek("D:\Slash.net") 
h,a=nx.hits(g) 

을하지만, 오류 다음 내가 가진 코드를 실행 :

Traceback (most recent call last): 
File "<stdin>", line 1, in <module> 
File "C:\Python27\lib\site-packages\networkx-1.7-py2.7.egg\networkx 
\link_analysis\hits_alg.py", line 74, in hits 
raise Exception("hits() not defined for graphs with multiedges.") 
Exception: hits() not defined for graphs with multiedges. 

친절하게 그것을 바탕으로 감사와 안부 보라!

+2

아마도 그래프에 멀티 영역이있을 수 있습니다. –

답변

1

read_pajek 함수는 g을 MultiGraph 또는 MultiDiGraph로 반환합니다. nx.Graph(g)으로 간단한 그래프로 변환하십시오.