[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] python.exe stop working!

From: Tamás Nepusz
Subject: Re: [igraph] python.exe stop working!
Date: Tue, 2 Sep 2014 01:07:21 +0200

> Hello, I have tried what you suggested ,but it still does not work.Both my 
> machine and 
> the Python interpreter are 64-bit,and I have used Read_Ncol instead of 
> Read_Edgelist. 
Well, it looks like that you are simply running into limitations of igraph 
itself. The internal data structure used by igraph uses 32 bytes per edge at 
the moment and 16 bytes per vertex. With a graph of your size, you would need 
~58GB of memory to store the entire graph. Since you have 128 GB at hand, I 
would try one more thing: try to recode the input graph such that the vertex 
IDs are from zero to |V|-1 and use Graph.Read_Edgelist() to read the graph. The 
reason is that Graph.Read_Ncol() needs to maintain an internal mapping from 
vertex names (as found in the file) to internal igraph vertex IDs. The 
conversion script is something like this in Python:

#!/usr/bin/env python
import sys
from igraph import UniqueIdGenerator

idgen = UniqueIdGenerator()

infile = open("your-graph.txt")
outfile = open("your-converted-graph.txt", "w")

for line in infile:
    if line.startswith("#"):
    u, v = line.strip().split()
    print >>outfile, idgen[u], idgen[v]


I tried to convert the data file but igraph also bailed out for me with the 
following message:

>>> g=load("recoded.txt", format="edgelist", directed=False)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "build/bdist.linux-x86_64/egg/igraph/__init__.py", line 3988, in read
    return Graph.Read(filename, *args, **kwds)
  File "build/bdist.linux-x86_64/egg/igraph/__init__.py", line 2173, in Read
    return reader(f, *args, **kwds)
MemoryError: Error at vector.pmt:439: cannot reserve space for vector, Out of 

However, I only have 16 GB of memory in my machine so it's kinda expected. The 
bottom line is that you should see the above error message if there is not 
enough memory in your machine to handle the graph. If you see any other message 
or the Python interpreter crashes, then you are probably hitting some kind of a 
memory limit that originates not from igraph but from the OS or the Python 

All the best,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]