40

考虑这个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
    }
}

在上面的例子中,只有1 -> 2连接会arrowhead=normal,arrowtail=dot应用样式;所有其他箭头将采用“默认”样式。

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

编辑:仅供参考 -杰西的答案不包含任何代码;我写了那个片段并把它放在这个空间里——不知什么原因,一位版主从这里剪掉了它,并将其粘贴到 Jesse 的答案中。

4

2 回答 2

49

使用边缘属性语句,如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
    }
}
于 2010-12-22T22:50:28.117 回答
9

就像您对节点所做的那样,但使​​用edge, 例如edge[style=dashed]

于 2010-12-22T22:50:59.930 回答