[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] Problems calculating shortest paths for sparse large graph
From: |
Tamás Nepusz |
Subject: |
Re: [igraph] Problems calculating shortest paths for sparse large graph |
Date: |
Wed, 21 Nov 2012 22:50:06 +0100 |
> I am trying to calculate the shortest paths for a large sparse graph
> (48000 nodes and 2000 edges). [...]
> shortest_paths<-shortest.paths(net,weights=E(net)$weight);
> Error in .Call("R_igraph_shortest_paths", graph, v - 1, to - 1,
> as.numeric(mode), :
> negative length vectors are not allowed
Oh, hang on. If you have 48K nodes, the resulting shortest path matrix would
have 48K * 48K elements. That's pretty big. I'm guessing that although you have
32GB of memory, you hit some kind of internal limit within R and it simply
cannot allocate the matrix it would require to return the result. The solution
is to calculate the shortest paths for each start vertex separately in a for
loop (use the v=... argument to specify the start vertex). You can also use
smaller batches, say, 1000 vertices at the same time.
Best,
Tamas