Closed sikasjc closed 6 years ago
有时间看看哈,最近实在是太忙了
2017-12-13 10:55 GMT+08:00 sikasjc notifications@github.com:
Closed #7 https://github.com/zzz24512653/CommunityDetection/issues/7.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/zzz24512653/CommunityDetection/issues/7#event-1384842720, or mute the thread https://github.com/notifications/unsubscribe-auth/AF46-2uBsHsuZsIw1jAZEJfaJaotF8fgks5s_zytgaJpZM4Q-5Xl .
networkx2.0里把G.neighbors()改成了生成器,line 9, in cal_Q应该为 t += len([n for n in G.neighbors(node)])
Traceback (most recent call last):
File "", line 1, in
runfile('C:/Users/HP/Desktop/CommunityDetection-master/algorithm/GN.py', wdir='C:/Users/HP/Desktop/CommunityDetection-master/algorithm')
File "C:\Users\HP\Anaconda3\envs\network\lib\site-packages\spyder\utils\site\sitecustomize.py", line 710, in runfile execfile(filename, namespace)
File "C:\Users\HP\Anaconda3\envs\network\lib\site-packages\spyder\utils\site\sitecustomize.py", line 86, in execfile exec(compile(scripttext, filename, 'exec'), glob, loc)
File "C:/Users/HP/Desktop/CommunityDetection-master/algorithm/GN.py", line 38, in
algorithm.execute()
File "C:/Users/HP/Desktop/CommunityDetection-master/algorithm/GN.py", line 26, in execute cur_Q = cal_Q(components, self._G_cloned)
File "../util\modularity.py", line 9, in cal_Q t += len(G.neighbors(node))
TypeError: object of type 'dictionary-keyiterator' has no len()
请问一下,这个要怎么解决