[R] igraph and plotting connected components

Gabor Csardi csardi at rmki.kfki.hu
Tue Oct 9 11:31:54 CEST 2007

On Mon, Oct 08, 2007 at 08:11:16PM -0500, elw at stderr.org wrote:
> Dot-file format is also *ridiculously simple* to generate , which I think 
> of as a factor well in its favor.  :-)

This is just

write.graph(g, format="dot", file="output.dot")

in igraph.

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

A similar thing is the 'tkplot' command in igraph, it has 
exactly the same arguments as the igraph 'plot' command. 
Another choice is the 'rglplot' command which uses the 'rgl'
package to visualize a graph in 3d.

> 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.  ;)

To convert an igraph graph to pajek format simply use

write.graph(g, format="pajek", file="output.net")

Btw. pajek runs nicely in the wine windows (not) emulator, so you
can use it on linux, OSX, etc. with some more effort.


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

More information about the R-help mailing list