我试图让Graphviz订购共享公共节点的节点,但不是完全相同的路径。在我的例子中,我有5个叶节点,都连接到同一个父节点。
虽然它们不仅无序,但它们也没有共享相同的途径。三片叶子通过一条路线到达,另外两片通过不同的路线到达(我不确定这是否重要)
我尝试设置' ordering = in / out'和类似的但到目前为止还无法弄清楚如何去做。非常感谢帮助。
我的示例树:
strict digraph "so example" {
rankdir=LR;
"0" -> "3" -> "4" -> "5" -> "C";
"0" -> "3" -> "4" -> "5" -> "A";
"0" -> "6" -> "7" -> "5" -> "E";
"0" -> "6" -> "7" -> "5" -> "D";
"0" -> "6" -> "7" -> "5" -> "B";
}
我正在寻找的是一种从上到下依次显示A,B,C,D和E的方法。
答案 0 :(得分:1)
按所需顺序对节点进行排序应该可以解决问题:
strict digraph "so example" {
rankdir=LR;
"0" -> "3" -> "4" -> "5" -> "A";
"0" -> "3" -> "4" -> "5" -> "B";
"0" -> "6" -> "7" -> "5" -> "C";
"0" -> "6" -> "7" -> "5" -> "D";
"0" -> "6" -> "7" -> "5" -> "E";
}
甚至更短:
strict digraph "so example" {
rankdir=LR;
"0" -> "3" -> "4" -> "5" -> {A; B; C; D; E;}
"0" -> "6" -> "7" -> "5";
}