Search code examples
graphviz

GraphViz custom back arrow


I have the following code:

digraph "Classes utilisées par Git"
{
    subgraph mother
    {
        O [shape=record, label = "{GitObject| ref (sha1)}"];
    }
    subgraph herited
    {
        rankdir=LR;
        rank="same";
        "Tree" [shape=box];
        "Tag" [shape=box];
        "Blob" [shape=box];
        "Commit" [shape=box];
    }
    O -> "Tree" [arrowhead="onormal", dir=back];
    O -> "Blob" [arrowhead="onormal", dir=back];
    O -> "Commit" [arrowhead="onormal", dir=back];
    O -> "Tag" [arrowhead="onormal", dir=back];
    "Tree" -> "Tree" [arrowhead="vee", label=" 0..*\n0..*1"];
    "Tree" -> "Blob" [arrowhead="vee", label=" 0..*\n1"];
    "Commit" -> "Tree" [arrowhead="vee", label=" 1..*\n1"];
    "Tag" -> "Commit" [arrowhead="vee", label=" 0..*\n1"];
}

which gives me:

enter image description here

I works well but arrows in direction of GitOject are not onormal, is their a way to fiw that?

For your help, Thanks by advance.


Solution

  • Just use arrowtail="onormal" instead of arrowhead="onormal" for the edges not displaying properly.

    arrowtail always refers to the tail of the edge as defined, and doesn't take into account dir=back.