How do I lengthen edges in an igraph network plot (layout=fruchterman.reingold)?

Monica picture Monica · May 11, 2011 · Viewed 10.5k times · Source

Trying to do a network plot in R. How do I lengthen edges in a network graph using IGraph?

I actually want to use the fruchterman-reingold layout. Is there some way I can make that force-based algorithm "springier" so that my vertices are further apart?

thanks.

Answer

Sacha Epskamp picture Sacha Epskamp · May 11, 2011

You can control the Fruchterman-Reingold algorithm using the layout.fruchterman.reingold function. see: help('layout.fruchterman.reingold'). A setup that I often use and gets you a little more spacing is:

l <- layout.fruchterman.reingold(g,niter=500,area=vcount(g)^2.3,repulserad=vcount(g)^2.8)
plot(g,layout=l)

where g is your graph object. Best to just test different values of these parameters for your graph and see what works. Especially repulserad influences the spacing in a graph. The default is the square of the number of nodes, so higher values should get you more spaced graphs.