How to have split arrow in GraphViz?

Viewed 173

I want to have branching arrows like this graph:

enter image description here

Here is my current code:

digraph {
    splines=curved
    a -> b -> c -> d -> e 
    e -> a [ label=1 ]
    e -> f [ label=2 ]
}

Using neato you can see that the arrows don't come from one root:

enter image description here

There is a trick to use an invisible joint node

digraph {
    splines=curved
    a -> b -> c -> d -> e 
    e -> joint [ dir=none ]
    joint [shape="none", label="", width=0, height=0]
    joint -> a [ label=1 ]
    joint -> f [ label=2 ]
}

But then the e -> a arrow is too long. And the arrow 2 is still not tangent with arrow 1.

enter image description here

Is there a way to achieve this effect?

2 Answers

Here's a tip:

digraph {
    splines=curved
    a -> b -> c -> d -> e 
    e -> joint [ dir=none ]
    joint [shape="none", label="", width=0, height=0]
    joint -> a [ label=1 ]
    joint -> f [ label=2 ]
    a -> f [style=invis]  //pull a and f together ~ "tangent" effect
}

I doubt if there is a better solution, Graphviz being what it is.

enter image description here

I figured out an answer that makes it look a bit more perfect.

digraph {
    a -> b -> c -> d -> e 
    e -> joint [ dir=none ]
    joint [shape="point", style="filled", label="", width=0, height=0]
    a -> joint [ dir=none, label=1 ]
    joint -> f [ label=2 ]
}
Related