41

Consider this dot language code:

digraph graphname {
    subgraph clusterA {
        node [shape=plaintext,style=filled];
        1 -> 2 [arrowhead=normal,arrowtail=dot];
        2 -> 3 -> X2 -> 5;
        6;
        7;
        label = "A";
        color=blue
    }
}

In the above example, only the 1 -> 2 connection will have the arrowhead=normal,arrowtail=dot style applied; all the other arrows will be of the "default" style.

My question is - how do I set the arrow style (for the entire subgraph - or for the entire graph), without having to copy paste "[arrowhead=normal,arrowtail=dot];" next to each edge connection?

EDIT: Just for reference - the answer from Jesse didn't contain any code; I wrote that snippet and had it in this space here - for unknown reasons, a moderator cut it off from here and pasted it into Jesse's answer.

2 Answers 2

51

Use the edge attribute statement, as stated in the DOT Language documentation.

digraph graphname {
    subgraph clusterA {
        node [shape=plaintext,style=filled];
        edge [arrowhead=normal,arrowtail=dot];
        1 -> 2 ;
        2 -> 3 -> X2 -> 5;
        6;
        7;
        label = "A";
        color=blue
    }
}
Sign up to request clarification or add additional context in comments.

2 Comments

Awesome - thanks for the answer, @JesseW - accept for the reference :) Btw, I was just found doxygen - how to change default font size for graphviz? - Stack Overflow which also, pretty much, explains the same :)
Just a note: you can also do this on the command line (i.e., without modifying the DOT file) by adding a command line parameter like -Earrowtail=dot. More generally -E is used to set default edge attributes, -N to set default node attributes and -G to set default graph attributes.
10

Just like you did for nodes, but using edge, e.g. edge[style=dashed]

1 Comment

Thanks for the quick answer too, @Fabian Steeg - gave the accept to @JesseW cause of the link :) Cheers!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.