GraphViz/dot 中节点顺序的随机变化
Random change of node order in GraphViz/dot
我正在尝试在 GraphViz/dot 中绘制一个小图表。
"Team 1"、"Turnier32" 和 "Team 2" 框应位于同一水平面上。
"Team 1" 指向右侧 "Turnier32","Team 2" 指向左侧。
我想要相应节点下方的省略号"Name1"、“2015-11-14”和"Name2"。应该只有直的水平和垂直边缘。
我目前的做法是:
digraph turnier{
ordering=out ;
subgraph {
rank=same;
T1 [shape="box", label="Team 1"];
TOURNAMENT [shape="box", label="Turnier32"];
T2 [shape="box", label="Team 2"];
}
subgraph {
rank=same;
N1 [shape="ellipse", label="Name1"];
DATE [shape="ellipse", label="2015-11-14"];
N2 [shape="ellipse", label="Name2"];
}
T1 -> N1 [label="hasName"];
TOURNAMENT -> DATE [label="occuredOnDate"];
T2 -> N2 [label="hasName"];
T1 -> TOURNAMENT [label="attended"];
T2 -> TOURNAMENT [label="attended"];
}
GraphViz 将 T1、TOURNAMENT 和 T2 重新排序为 T1、T2、TOURNAMENT,这不是我想要的。如果我删除了最后两条边,则顺序正确。
只需添加到您的最后一行 constraint=false
:
T2 -> TOURNAMENT [label="attended", constraint=false];
我正在尝试在 GraphViz/dot 中绘制一个小图表。 "Team 1"、"Turnier32" 和 "Team 2" 框应位于同一水平面上。 "Team 1" 指向右侧 "Turnier32","Team 2" 指向左侧。 我想要相应节点下方的省略号"Name1"、“2015-11-14”和"Name2"。应该只有直的水平和垂直边缘。 我目前的做法是:
digraph turnier{
ordering=out ;
subgraph {
rank=same;
T1 [shape="box", label="Team 1"];
TOURNAMENT [shape="box", label="Turnier32"];
T2 [shape="box", label="Team 2"];
}
subgraph {
rank=same;
N1 [shape="ellipse", label="Name1"];
DATE [shape="ellipse", label="2015-11-14"];
N2 [shape="ellipse", label="Name2"];
}
T1 -> N1 [label="hasName"];
TOURNAMENT -> DATE [label="occuredOnDate"];
T2 -> N2 [label="hasName"];
T1 -> TOURNAMENT [label="attended"];
T2 -> TOURNAMENT [label="attended"];
}
只需添加到您的最后一行 constraint=false
:
T2 -> TOURNAMENT [label="attended", constraint=false];