[R] graph or svn

Gabor Csardi csardi at rmki.kfki.hu
Tue Oct 9 11:39:19 CEST 2007


Paul,

if you have large graphs the igraph package might help,
it works very well with large sparse graphs. To convert an adjacency
matrix (A) to an igraph graph object (g) you can simply use

library(igraph)
g <- graph.adjacency(A)

and then you can generate layouts with layout.fruchterman.reingold
(or some other layout function), Fruchterman-Reingold should 
work for your graph, but it might take a couple of minutes. 
You can even weight the edges and then larger weights forces the 
adjacenct vertices to be placed closer to each other.

For plotting the graphs see ?plot.igraph, ?tkplot and ?rglplot and also
?igraph.plotting for the fine bits.

Gabor

On Mon, Oct 08, 2007 at 04:04:00PM -0700, H. Paul Benton wrote:
> Hello all,
> 
>     I'm having a spot of trouble. I have made a very nice distance
> matrix  from some comparison calculations. However, the matrix is 3096 x
> 3096, so it's relatively large. Currently I'm using the svn package as
> it seems to work for my data. The graph package errors and says the
> "adjacency matrix must be symmetric for undirected graphs". I though
> 3096 x 3096 was symmetric?? 
> However, the with the svn package the gplot command has been running for
> 6hr's now and no end in sight :) . Is there another package that i can
> use or a way to speed up the analysis, or even another way of displaying
> the data than the nodes and edges plot?
> 
>     Cheers,
> 
>     Paul
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Csardi Gabor <csardi at rmki.kfki.hu>    MTA RMKI, ELTE TTK



More information about the R-help mailing list