[R] igraph and plotting connected components

elw at stderr.org elw at stderr.org
Tue Oct 9 03:11:16 CEST 2007



>> Hello there,
>>
>>   I am using the igraph package to build graphs from my data. If I plot 
>> a graph though, it's not easy for me to see what's going on. Does 
>> anybody know how to rearrange a graph to get a plot without too many 
>> crossing lines? Maybe other packages?


Edge-crossing minimization is a research topic all in itself, for folks 
who deal with graph-style data on a regular basis.  ;-)  It is *hard* to 
construct sane graphs automatically, which is why software in this area so 
frequently produces what appear to be sub-par results.  [And it is 
difficult for human beings to evaluate the 'quality' of such graphs, 
comparatively - we just aren't good at this task.]


> Rgraphviz in Bioconductor does a great job of this.  It's a wrapper for 
> the Graphviz library, so the R docs are a little sparse, but there's a 
> tremendous amount of flexibility there.


Seconded - graphviz in general is quite good; getting your data into 
dot-file format is often a productive step in the viz process.

Dot-file format is also *ridiculously simple* to generate , which I think 
of as a factor well in its favor.  :-)

the dynamicGraph package (which I think lives in bioconductor as well) is 
reasonably useful for smallish graphs.

I hear that there's a tk-based interactive graph layouter available with 
graphviz's source - you might look there, too.

There's also Pajek, which is pretty and interactive but not R, 
for-Windows, and not even very compatible with the data formats usually 
used by folks with R.  ;)

There's also the pixelglow build of graphviz on OSX, which is beautiful 
and fun to mess with.

There are a couple other graph packages as well... most not interactive, 
which sounds like what you're likely wanting.

[With some of the iterative graph rendering algorithms - particularly the 
ones that deal with energy minimization algorithms and the like - 
nondeterministic mostly - you can sometimes re-run the layout function and 
get wildly different results, particularly for complex graphs.  You might 
try this.]


--elijah wright
school of library and information science
indiana university, bloomington



More information about the R-help mailing list