如何将节点定位在neato图的顶部?

时间:2017-02-02 02:24:43

标签: graphviz dot neato

是否有可能强制graphviz在此图顶部放置节点" a" ?我尝试过 neato fdp

{{1}}

neato diagram

1 个答案:

答案 0 :(得分:1)

如果您想使用neato,可以尝试使用pos属性:

digraph G {
    "a" [pos="0,2!"];
    "b";
    "c";
    "d";
    "e";
    "a" -> "b";
    "a" -> "d";
    "a" -> "a";
    "b" -> "c";
    "c" -> "d";
    "d" -> "e";
    "e" -> "a";
}

使用dot布局时,您可以围绕边缘方向切换,以确保a保持在最顶层:

digraph G {
    "a";
    "b";
    "c";
    "d";
    "e";
    "a" -> "b";
    "a" -> "d";
    "a" -> "a";
    "b" -> "c";
    "c" -> "d";
    "d" -> "e";
    "a" -> "e" [dir=back];
}