我有一些比较简单的(自动生成的)图形,采用了graphviz点格式。这些图显示了通过状态机的路径,但是当我希望图处于状态顺序时,DOT有一个稍微令人困惑的习惯,即决定两个节点必须处于相同的列组。我尝试了很多设置(包括
:n
和
:s
以及
weight
但我不能说服DOT将第三个州
在上面
第四个州。
我在很多图中都有这个问题:点内部似乎存在某种东西,它决定如果两个节点在同一个列组上,并且没有什么可以覆盖它的话,情况会更好。我甚至有代码指定一个节点应该是
rank=sink
,但DOT还是决定在它下面放置另一个节点。
有没有什么方法可以建议点,节点的顺序比任何其他约束都重要?
用于生成图表的代码如下所示:
digraph {
ERROR [label="Error"];
FirstSTATE [label="Initial State" URL="\ref FirstSTATE"];
FirstSTATE -> SecondSTATE;
SecondSTATE [label="Second State" URL="\ref SecondSTATE"];
SecondSTATE -> ThirdSTATE;
ThirdSTATE [label="Third State" URL="\ref ThirdSTATE"];
FourthSTATE [label="Fouth State?" shape="diamond"];
ThirdSTATE:s -> FourthSTATE:n [weight=50];
FourthSTATE -> FifthSTATE [label="Yes" ];
FourthSTATE -> ThirdSTATE [label="No"];
FifthSTATE [label="Fifth State" URL="\ref FifthSTATE"];
SixthSTATE [label="Sixth State?" shape="diamond"];
SixthSTATE -> ERROR [label="Yes" ];
SixthSTATE -> SeventhSTATE [label="No"];
FifthSTATE -> SixthSTATE;
SeventhSTATE [label="Seventh State" URL="\ref SeventhSTATE"];
SeventhSTATE -> EighthSTATE;
EighthSTATE [label="Eighth State" URL="\ref EighthSTATE"];
NinthSTATE [label="Ninth State?" shape="diamond"];
NinthSTATE -> TenthSTATE [label="Yes" ];
NinthSTATE -> EighthSTATE [label="No"];
EighthSTATE -> NinthSTATE;
TenthSTATE [label="Tenth State" URL="\ref TenthSTATE"];
EleventhSTATE [label="Eleventh State?" shape="diamond"];
EleventhSTATE -> ERROR [label="Yes" ];
EleventhSTATE -> TwelfthSTATE [label="No" ];
TenthSTATE -> EleventhSTATE;
TwelfthSTATE [label="Twelfth State" URL="\ref TwelfthSTATE"];
}
图表当前如下所示: