Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Graphviz: how to set 'default' arrow style?

Tags:

graphviz

dot

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.

like image 514
sdaau Avatar asked Dec 22 '10 22:12

sdaau


Video Answer


2 Answers

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
    }
}
like image 194
JesseW Avatar answered Oct 25 '22 12:10

JesseW


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

like image 9
Fabian Steeg Avatar answered Oct 25 '22 12:10

Fabian Steeg