添加大量边时,iGraph Python中的内存错误

时间:2016-03-08 17:15:28

标签: python graph network-programming igraph

关于这个帖子:http://goo.gl/uEyFua

我遇到了与以下代码完全相似的问题,尝试导入一个大型图表:

for (edge_id) in cursorSQL:
 L.add((edge_id[2], str(edge_id[1])))

g = igraph.Graph.TupleList(L)

我收到以下错误:

Traceback (most recent call last):


File "C.py", line 707, in __getitem__  return self._ids[item]
KeyError: '184840900'

During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
     g = igraph.Graph.TupleList(L)
  File "C:\Python34\lib\site-packages\igraph\__init__.py", line 2473, in TupleList

  edge_list.append((idgen[item[0]], idgen[item[1]]))

  File "C:\Python34\lib\site-packages\igraph\datatypes.py", line 709, in __getitem__
  self._ids[item] = next(self._generator)

     MemoryError

只是说清楚。这段代码完美无缺,直到边数太大(约4百万)。

感谢。

1 个答案:

答案 0 :(得分:0)

切换到python-64bits,问题现在解决了。

问题是win7中python-32bits的每个进程限制为2GB。