igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] igraph-help Digest, Vol 78, Issue 10


From: Tamás Nepusz
Subject: Re: [igraph] igraph-help Digest, Vol 78, Issue 10
Date: Sun, 27 Jan 2013 14:03:52 +0100

Hi,

> For (deg in 1:6) (
> Loc <-which (sp==deg)
> [...]
> I get the following error message:
> 
> Error in which (sp == deg): cannot allocate memory block of size 2.0 GB
> 
> Does anyone know what a "memory block" is?  Or, how to increase the size 
> allocated to a memory block?
The message simply means that R is trying to allocate an additional 2 GBs of 
memory (presumably to store the result of sp == deg) and it is unable to do so. 
This could be due to multiple reasons, the simplest being that you simply don't 
have 2GB of memory available (because it is already allocated to other 
variables). Another cause could be that you are hitting an internal limitation 
of R:

http://stat.ethz.ch/R-manual/R-devel/library/base/html/Memory-limits.html

It does not necessarily matter that your computer has 16 GBs of memory; it 
could still be the case that a single _process_ (like R) is not allowed to 
occupy more than X GBs of memory and X is smaller than what you need.

Either way, you will have to re-write your code so that it does not try to 
allocate so much memory. If I understand correctly, your primary goal is to get 
all pairs of vertices whose distance (in terms of shortest paths) is exactly 
'deg' steps. You do not seem to se the contents of 'sp' anywhere else, which 
means that you can simply create a separate for loop that calculates 'sp' 
_row_by_row_, for each start vertex (using the appropriate arguments of the 
shortest.paths function), and collect the corresponding vertices that can be 
reached from the start vertex in a given number of steps, then store these in 
some data structure and re-use this inside your main for loop instead of the 
whole 'sp' matrix.

-- 
T.




reply via email to

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