related questions are:
Graphviz: Place edge label on the other side
How to place edge labels ON edge in graphviz
Consider following dot file:
digraph {
0 -> 1 [ len=2, label="(1, 0)"];
0 -> 1 [ len=0.5, dir=none, weight=10];
1 -> 0 [ len=2, label="(0, -1)"];
}
giving following result:
How can I manage to get a symmetric version? (0,-1)
should be left of the right egde.
As you've found out, graphviz doesn't let you choose horizontal label placement, so all solutions are slightly hacky.
Attempt #1: The two solutions posted by marapet (here)
The labelangle and labeldistance trick doesn't adapt well to
different lengths of label text (you'd have to recalculate new
distance/angle numbers).
The splines=false trick doesn't work so well where the number of
edges between nodes > the number of nodes (you end up with
overlapping edges).
Attempt #2: xlabels and anchors to create curved edges
This uses a relatively new feature of graphviz, xlabel (which places the label AFTER the coordinates for the nodes/edges have been decided). The ports feature is used to create curved edges. The padding on the labels is achieved with space characters.
digraph {
forcelabels=true;
0:sw -> 1:nw [ dir=forward, xlabel=" (1, 0) "];
0 -> 1 [dir=none];
1:ne -> 0:se [ dir=backward, xlabel= " (0, -1) "];
}
I believe you need graphviz version >2.29 to use xlabel.