Is there a layout in igraph that can arrange the nodes in 2 separate groups ? To achieve something like this image ?
You can give
layout_as_bipartite a try.
That arranges the nodes in 2 rows. Is there a way to change that arrangement to columns ?
What I did is use
layout_as_tree and then create a graph object. Later, I accessed the x values and then assigned - x to the one group and then +x values for another group. Here is my SO question .
I have them separated, but was thinking if there may be more appropriate way to do this. I would like to have more control on assigning positions to the nodes.
What the bipartite layout does is that it finds an ordering of vertices within the two groups so as to minimize the number of edge crossings when both are arranged in a line.
You can try to build something on top of this:
- You can swap x and y coordinates to use rows instead of columns.
- You can manually stagger vertices instead of placing them on a line—this should still maintain few edge crossings.
would mind to provide an example, I did not understand on how to swap x and y co-ordinates