>>>>> "SS" == Surendar Swaminathan
<surendar.swaminathan at gmail.com>
>>>>> on Mon, 20 Apr 2009 12:10:47 -0700 writes:
SS> Hello All, I am working on graph object using IGRAPH
SS> package wanted to do Bonacich Power. This is my graph
SS> object.
SS> The file 'Graph.RData' (4.2 MB) is available for
SS> download at
SS> http://dropbox.unl.edu/uploads/20090424/cfe4fcb854bb17f2/Graph.RData
SS> Graph size
SS> Vertices: 20984 Edges: 326033 Directed: FALSE No graph
SS> attributes. Vertex attributes: name. No edge
SS> attributes.
SS> When I use bonacich power it goes out of memory
SS> Error in get.adjacency.dense(graph, type = type, attr SS>
attr, names = names, : At vector.pmt:409 : cannot
SS> reserve space for vector, Out of memory
how much memory (RAM) has your computer?
I have tried in a few ways to reproduce your problem,
but have not got any errors, neither when using the 'test.g'
example you use below, nor by using
bonpow.sparse(g)
where 'g' comes from your 'Graph.RData' file (you mention
above).
But you have not provided (in your e-mail) a fully reproducible
example, so I am not sure how exactly you got the memory problem
(or even worse the "crash"es).
Regards,
Martin Maechler, ETH Zurich
(co-maintainer of 'Matrix').
SS> I got help from IGRAPH community to use sparse Matrix
SS> http://igraph.wikidot.com/r-recipes#toc6
SS> bonpow.sparse <- function(graph, nodes=V(graph),
SS> loops=FALSE, exponent=1, rescale=FALSE, tol=1e-07) {
SS> ## remove loops if requested if (!loops) { graph <-
SS> simplify(graph, remove.multiple=FALSE,
SS> remove.loops=TRUE) }
SS> ## sparse adjacency matrix d <- get.adjacency(graph,
SS> sparse=TRUE)
SS> ## sparse identity matrix id <-
SS> spMatrix(vcount(graph), vcount(graph),
SS> i=1:vcount(graph), j=1:vcount(graph), x=rep(1,
SS> vcount(graph))) id <- as(id, "dgCMatrix")
SS> ## solve it ev <- solve(id - exponent * d, tol=tol)
SS> %*% degree(graph, mode="out")
SS> if (rescale) { ev <- ev/sum(ev) } else { ev <- ev *
SS> sqrt(vcount(graph)/sum((ev)^2)) }
SS> ev[as.numeric(nodes) + 1] }
SS> ## test graph test.g <- simplify(ba.game(1000,m=2))
SS> ## test run system.time(bp1 <- bonpow(test.g))
SS> system.time(bp2 <- bonpow.sparse(test.g))
SS> ## check that they are the same max(abs(bp1-bp2)) I get
SS> following error and sometime it crashes.
SS> In solve(id - exponent * d, tol = tol) : Reached total
SS> allocation of 1535Mb: see help(memory.size).I increased
SS> the memory size and still it is not helpful
SS> Help on this would be great.
SS> These are steps I followed
SS> 1. Created graph object using Igraph version 0.6 on R
SS> 2.8.1 windows XP 2. Bonpow(g) 3. Bonpow.sparse function
SS> sessionInfo()
SS> R version 2.8.1 (2008-12-22) i386-pc-mingw32 locale:
SS> LC_COLLATE=English_United
SS> States.1252;LC_CTYPE=English_United
SS> States.1252;LC_MONETARY=English_United
SS> States.1252;LC_NUMERIC=C;LC_TIME=English_United
SS> States.1252 attached base packages: [1] stats graphics
SS> grDevices utils datasets methods base other attached
SS> packages: [1] Matrix_0.999375-23 lattice_0.17-20
SS> igraph_0.6 loaded via a namespace (and not attached):
SS> [1] grid_2.8.1
SS> Thanks in advance
SS> Nathan
SS> [[alternative HTML version deleted]]
SS> ______________________________________________
SS> R-help at r-project.org mailing list
SS> https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do
SS> read the posting guide
SS> http://www.R-project.org/posting-guide.html and provide
SS> commented, minimal, self-contained, reproducible code.