Which layout should I use to get non-overlapping edges in igraph?

Marcus Shepheard picture Marcus Shepheard · Dec 19, 2012 · Viewed 29.4k times · Source

I am trying to build graphs using tree-like data, where nodes typically split into >2 edges. I have tried various layouts, and I see that the layout.reingold.tilford parameter will generate tree-like graphs with non-bifurcating data. However the outputs are not particularly attractive. I would rather use something like the layout.lgl or layout.kamada.kawai since these produce more radial structures. I cannot see how to change the parameters in R such that these trees have no overlapping edges though. Is this possible?

I imported a simple data file in Pajek format, with 355 nodes and 354 edges. I'm currently printing it using:

plot.igraph(g,vertex.size=3,vertex.label=NA,layout=layout.lgl)

This gives me an output like this, which is nice, but still has overlapping edges. I have read that you can manually fix this using tkplot, or another program like cytoscape, however I have quite a few of these to build, and the size of them makes manual correction a hassle.

Many thanks. Here is an example of the output I get

Answer

morphe picture morphe · Jul 22, 2015

Just want to add a comment but my rep is too low. The method that @bdemarest posted does not work on igraph version > 0.7. The newer version does not support the area parameter, so I cannot get the same effect. And getting the old version to build took me a while, so I though I'd share some insights. You can manually install igraph 0.7 from source if you download it from igraph nightly builds. On my machine (Mac OS 10.10), I encountered some problems building it, due to gfortran, so I found this link that solved the problem. Hope that helps anyone who wants to create similar graphs in R.