1
我想使用python igraph庫加載.net文件。下面是示例代碼:閱讀.net pajek文件使用python igraph庫
import igraph
g = igraph.read("s.net",format="pajek")
但是,當我試圖運行該腳本,我得到了以下錯誤:
Traceback (most recent call last):
File "demo.py", line 2, in <module>
g = igraph.read('s.net',format="pajek")
File "C:\Python27\lib\site-packages\igraph\__init__.py", line 3703, in read
return Graph.Read(filename, *args, **kwds)
File "C:\Python27\lib\site-packages\igraph\__init__.py", line 2062, in Read
return reader(f, *args, **kwds)
igraph._igraph.InternalError: Error at .\src\foreign.c:574: Parse error in Pajek
file, line 1 (syntax error, unexpected ARCSLINE, expecting VERTICESLINE), Parse error
請提供一些暗示了它。
謝謝@Tamas。我剛剛發送了用戶名爲quamar niyaz @ gmail.com的.net pajek文件。 Kinly看看它。 – user976754 2013-02-25 10:45:41
查看我答案中的更新。 – 2013-02-25 10:56:12
謝謝@Tamas,我通過這樣做了檢查,但我認爲文件格式有問題。但第二個文件運行良好,加入 * Vertices N. – user976754 2013-02-25 12:54:28