交换GraphViz图(DOT)中两个节点的位置
我使用交换GraphViz图(DOT)中两个节点的位置,graphviz,dot,Graphviz,Dot,我使用DOT语言在R中创建一个图表。当我得到一个奇怪的结果时,我对如何交换两个节点的位置感兴趣:节点8和节点c4 守则: digraph DAG { # Initialization of node attributes node [shape = box, color = blue]; 2; 3; 4; # Revision to node attributes { node [shape = box,style = filled,fillcolor = y
DOT
语言在R
中创建一个图表。当我得到一个奇怪的结果时,我对如何交换两个节点的位置感兴趣:节点8和节点c4
守则:
digraph DAG {
# Initialization of node attributes
node [shape = box, color = blue]; 2; 3; 4;
# Revision to node attributes
{ node [shape = box,style = filled,fillcolor = yellow]; 8}
# Revision to node attributes
{ node [shape = diamond, color = "red"]; c1; c2; c3; c4}
{ rank=same; c1; c2; c3}
{ rank=same; 8; c4}
# Initialization of edge attributes
edge [color = green, rel = yields]
# Edge statements
2->c1 [headport = w];
c1->c2->c3
c2->c1 [tailport = n, headport = n];
8->c3 [tailport = n, headport = s];
c3->3 [tailport = e, headport = n];
c3->c2 [tailport = n, headport = n];
3->c4 [tailport = s, headport = n];
c4->4 [tailport = s, headport = n];
c4->8 [tailport = w, headport = e];
}
结果(不正确)为:
对于“错误方向”边缘,您可以
- 交换节点并使用属性
反转其“力”dir=back
- 使用属性
禁用其“强制”constraint=none
8->c4 [tailport = e, headport = w, dir = back];
8->c4 [tailport = e, headport = w, dir = back];
由任何一方
c4->8 [tailport = w, headport = e, constraint = none];
或者
对于“错误的方式”边缘,您可以
- 交换节点并使用属性
反转其“力”dir=back
- 使用属性
禁用其“强制”constraint=none
8->c4 [tailport = e, headport = w, dir = back];
8->c4 [tailport = e, headport = w, dir = back];
由任何一方
c4->8 [tailport = w, headport = e, constraint = none];
或者