Graphviz:如何设置'默认'箭头样式?

sda*_*aau 29 dot graphviz

考虑这个dot语言代码:

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
    }
}
Run Code Online (Sandbox Code Playgroud)

在上面的示例中,只有1 -> 2连接将arrowhead=normal,arrowtail=dot应用样式; 所有其他箭头将是"默认"样式.

我的问题是 - 如何设置箭头样式(对于整个子图 - 或整个图形),而不必[arrowhead=normal,arrowtail=dot];在每个边连接旁边复制粘贴" "?

编辑:仅供参考 - 杰西答案不包含任何代码; 我写了那个片段并在这里占据了这个空间 - 由于不明原因,主持人将其从这里剪掉并粘贴到Jesse的答案中.

Jes*_*seW 36

使用edge属性语句,如DOT语言文档中所述.

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
    }
}
Run Code Online (Sandbox Code Playgroud)

  • 太棒了 - 感谢您的回答,@JesseW - 接受参考:)顺便说一句,我刚刚发现 [doxygen - 如何更改 graphviz 的默认字体大小?- Stack Overflow](http://stackoverflow.com/questions/1938200/how-to-change-default-font-size-for-graphviz) 这也几乎解释了同样的:) (2认同)

Fab*_*eeg 7

就像你为节点做的那样,但是使用edge,例如edge[style=dashed]