Patrick Maupin
Patrick Maupin

Reputation: 8137

Controlling edge order in graphviz dot

I can't figure out how to control edge placement with dot. I have created a small example to show my question. This may or may not be a MCVE; in the process of making it Minimal and Verifiable, I may have dropped the Complete. Anyway:

digraph stuff {
    rankdir=LR;
    a->b->c->b->a
}

$ dot -V
dot - graphviz version 2.38.0 (20140413.2041)
dot barfu.dot -Tpng > barfu.png

gives me this:

enter image description here

But I'd like to have the left-to-right arrows consistently on top, to reflect the normal state transitions. (Actually, it would be preferable to have them be straight lines in the middle, and have the right-to-left ones always curve below.)

I tried changing the line weight, the length, adding groups, setting connector directions, etc. Nothing seems to help, at least in the bigger graph this comes from.

Upvotes: 1

Views: 755

Answers (1)

Patrick Maupin
Patrick Maupin

Reputation: 8137

This doesn't work in my larger diagram, so other answers are still most welcome, but it appears that, since graphviz starts with a default top-down graph, with the most important (downward pointing edges) on the left, they do a simple rotation when you make the graph go left to right, which rotates the top of the graph to the left, and thus the most important edges from the left to the bottom. So, of course, this really simple test case can be fixed by making the graph go right-to-left instead of left-to-right.

digraph stuff {
    rankdir=RL;
    c->b->a->b->c;
}

enter image description here

Upvotes: 1

Related Questions