igraph-help
[Top][All Lists]

## Re: [igraph] the old "cannot reserve space for vector" problem

 From: Tamas Nepusz Subject: Re: [igraph] the old "cannot reserve space for vector" problem Date: Sat, 5 Jun 2010 10:29:02 +0100

```Hi Alisa,

> I'm having the "cannot reserve space for vector...." problem on the following
> operation and graph. From reading through the igraph archives, this appears
> to be a RAM issue.
Yes, it is a RAM issue; for large graphs, the whole matrix which stores all the
shortest path lengths tends to be large, and there's no workaround if you need
all the elements of the whole matrix at once. If you don't, you can calculate
the shortest paths from a single or a few selected vertices only. For instance:

for (i in 1:vcount(g)) {
sp <- shortest.paths(g, v=i)
}

This gives you the shortest path lengths from vertex i, one by one.

By the way, the shortest path matrix of a graph with 18209 vertices has
331567681 elements; if each element takes up 8 bytes, then the total memory
requirement for storing the whole matrix at once will be about 2.47Gb, so the
trick suggested by Łukasz might also work.

--
Tamas

> If I try to switch to a 64-bit machine, will this problem be solved? This is
> the smallest of 4 graphs that I plan to analyze thus. The largest graph has
> around 98 000 nodes and 135 000 edges. Can anyone give me an idea of a ball
> park amount of RAM needed accomplish this operation?
>
> Otherwise, if I am wrong and there is another workaround, please let me know.
>
> Thanks!
>
> > memory.limit(size = NA)
> [1] 1535
> > Dg1937 <- shortest.paths(g1937_1un,v=V(g1937_1un))
> Error in shortest.paths(g1937_1un, v = V(g1937_1un)) :
>   At vector.pmt:409 : cannot reserve space for vector, Out of memory
> > summary(g1937_1un)
> Vertices: 18209
> Edges: 27945
> Directed: FALSE
> No graph attributes.
> No vertex attributes.
> No edge attributes.
>
>
> Alisa Coffin, PhD