我可以使用此代码生成图表:
档案test.dot:
digraph g {
{rank=same; 1 -> 2 -> 3 -> 4}
{rank=same; 5 -> 6 -> 7 -> 8}
{rank=same; 9 -> 10 -> 11 -> 12}
4 -> 5
8 -> 9
}
Run Code Online (Sandbox Code Playgroud)
dot test.dot -Tpng -o test.png
输出:
但是,我希望节点的排列更像这样:
是否可以制作这样的图形graphviz dot?
使用具有较强重量的隐形边缘:
digraph g
{
splines="ortho"
// connect the left most nodes and keep them one below the other
1 -> 5 -> 9[ style = invis, weight = 10 ];
// do your stuff
{ rank = same; 1 -> 2 -> 3 -> 4 }
{ rank = same; 5 -> 6 -> 7 -> 8 }
{ rank = same; 9 -> 10 -> 11 -> 12 }
4 -> 5;
8 -> 9;
}
yields
Run Code Online (Sandbox Code Playgroud)