Alb*_*tti 17 binary-tree graphviz binary-search-tree
我正在尝试使用GraphViz绘制二叉树,但我有关于左孩子和右孩子的问题.有一种方法可以强迫节点成为正确的孩子吗?这是我的示例代码:
digraph G{
5 -> 3;
5 -> 8;
3 -> 1;
3 -> 4;
8 -> 6;
8 -> 12;
}
Run Code Online (Sandbox Code Playgroud)
dgw*_*dgw 21
这应该做到这一点.ordering=out表示节点应按输入中指定的顺序保留.
digraph G{
graph [ordering="out"];
5 -> 3;
5 -> 8;
3 -> 1;
3 -> 4;
8 -> 6;
8 -> 12;
}
Run Code Online (Sandbox Code Playgroud)