I want to generate simple linear arrangements like this:
I think I am making this way too hard. I tried just hard coding the positions, but it is a little more complicated because I want splined edges.
I don't particularly care if the edges are above or below, but specifying that would be a nice feature.
That's one of those things one may think it must be simple to do with graphviz, but in fact it's not.
Graphviz is made to minimize edge crossing, therefore it would never lay edges out as in those pictures. That's not what graphviz was made for.
But I agree it would be nice to have an option to turn off edge optimization.
You may create something like this:
rankdir=LR;
ranksep=0;
edge[style=invis];
node[shape=none, width=0.3, height=0, margin=0.02];
4->7->5->1->8->3->6->2;
edge[style=solid, constraint=false];
1:s->2:s->3:s->4:s->5:s->6:s->7:s->8:s
resulting in
As soon as you start using north and south ports, graphviz will try to minimize edge crossings and lead some of the edges between the nodes:
rankdir=LR;
ranksep=0.05;
edge[style=invis];
node[shape=none, width=0.3, height=0, fontsize=12, margin=0.02];
4->7->5->1->8->3->6->2;
edge[style=solid, weight=0];
1:n->2:n;
2:s->3:s->4:s;
4:n->5:n->6:n;
6:s->7:s;
7:n->8:n;
If anybody has a better approximation, please post it, I'd be interested.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With