graphvizneato

Increase curvature of connecting arcs


Consider:

digraph D {
    0[pos="0,0!"]
    1[pos="0,5!"]
    0 -> 1[label=0.25]
    1 -> 0[label=0.50]
}

Rendered under neato engine, this gives:

enter image description here

Is there a way to increase/control the curvature of the connecting arcs so that the rendering is something like the hand-drawn annotations below:

enter image description here


Edited to add: While I don't have to stick with neato, it is important in my application that the node pos coordinate values be upheld.


Solution

  • [there may be better ways, but edges are pretty hard to wrangle]
    This solution requires neato -n (see https://graphviz.org/faq/#FaqDotWithNodeCoords) and (https://graphviz.org/docs/attrs/pos/)
    Different versions of neato seem to produce different results when previous answer is input. This input file should work with older & newer versions of neato.

    digraph D {
        // next  lines from the Graphviz FAQ
        overlap=false
        splines=true
        
        0[pos="0,0!"]
        1[pos="0,5!"] 
        // stick an invisible node in the middle, to force the edges out
        half [pos="0,2.5!" width=1.1 height=1  style=invis]  
        0:nw -> 1:sw [label=0.25]
        1:se -> 0:ne [label=0.50]
    }
    

    Giving:
    enter image description here