各位,我是新来的。你知道吗
我试图执行我下载的代码from here
使用数据集可以是downloaded here.
import snap
UGraph = snap.LoadEdgeList(snap.PUNGraph, "CA-GrQc.txt")
# UGraph = snap.GenRndGnm(snap.PUNGraph, 100, 1000)
CmtyV = snap.TCnComV()
modularity = snap.CommunityCNM(UGraph, CmtyV)
for Cmty in CmtyV:
print "Community: "
for NI in Cmty:
print NI
print "The modularity of the network is %f" % modularity
当我执行它时,我得到以下运行时错误:
Traceback (most recent call last): File "C:/Users/Ahmed/.PyCharmCE2017.2/config/scratches/snap_CNM.py", line 44, in <module> modularity = snap.CommunityCNM(g, CmtyV) File "C:\Python27\lib\site-packages\snap.py", line 31114, in CommunityCNM return _snap.CommunityCNM(Graph, CmtyV) RuntimeError: Execution stopped: (0<=ValN)&&(ValN<Vals) [Reason:'Index:-1 Vals:5242 MxVals:5242 Type:TVec<class THashKeyDat<class TInt,struct TSnap::TSnapDetail::TCNMQMatrix::TCmtyDat>,int>'], file s:\glib-core\ds.h, line 491
但是当我在注释第二行和取消注释第三行之后执行代码时,它工作正常。你知道吗
我重新标记了数据集中的节点,使它们从0开始到5241,得到了相同的错误。你知道吗
有人能告诉我这里发生了什么事以及如何纠正错误吗?你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐