我知道有一些相关的问题,但我想知道是否有更好的解决方案来强制 graphviz 以定义的顺序保持节点位置。
这是我的问题:我有两个子图,每个子图有 5 个节点。每个节点都连接到另一个图的每个节点。我希望节点保持从 1-1 到 1-5 的顺序。但是graphviz总是把它们混在一起。
这是图表,我正在使用 DOT:
digraph G {
rankdir=LR;
ranksep=4.0;
subgraph cluster_1 {
rank=same;
label="Nr:1";
"1-1" [width=1, shape=circle, style=filled, fillcolor="#E3A869", label="1-1"];
"1-2" [width=1, shape=circle, style=filled, fillcolor="#E3A869", label="1-2"];
"1-3" [width=1, shape=circle, style=filled, fillcolor="#E3A869", label="1-3"];
"1-4" [width=1, shape=circle, style=filled, fillcolor="#E3A869", label="1-4"];
"1-5" [width=1, shape=circle, style=filled, fillcolor="#E3A869", label="1-5"];
}
subgraph cluster_2 {
rank=same;
label="Nr:2";
"2-1" [width=1, shape=circle, style=filled, fillcolor="#E3A869", label="2-1"];
"1-1" -> "2-1" [color=blue, labelfontcolor="#009933", fontsize="10.0", penwidth=1];
"1-2" -> "2-1" [color=blue, labelfontcolor="#009933", fontsize="10.0", penwidth=1];
"1-3" -> "2-1" [color=blue, labelfontcolor="#009933", fontsize="10.0", penwidth=1];
"1-4" -> "2-1" [color=blue, labelfontcolor="#009933", fontsize="10.0", penwidth=1];
"1-5" -> "2-1" [color=blue, labelfontcolor="#009933", fontsize="10.0", penwidth=1];
"2-2" [width=1, shape=circle, style=filled, fillcolor="#E3A869", label="2-2"];
"1-1" -> "2-2" [color=blue, labelfontcolor="#009933", fontsize="10.0", penwidth=1];
"1-2" -> "2-2" [color=blue, labelfontcolor="#009933", fontsize="10.0", penwidth=1];
"1-3" -> "2-2" [color=blue, labelfontcolor="#009933", fontsize="10.0", penwidth=1];
"1-4" -> "2-2" [color=blue, labelfontcolor="#009933", fontsize="10.0", penwidth=1];
"1-5" -> "2-2" [color=blue, labelfontcolor="#009933", fontsize="10.0", penwidth=1];
"2-3" [width=1, shape=circle, style=filled, fillcolor="#E3A869", label="2-3"];
"1-1" -> "2-3" [color=blue, labelfontcolor="#009933", fontsize="10.0", penwidth=1];
"1-2" -> "2-3" [color=blue, labelfontcolor="#009933", fontsize="10.0", penwidth=1];
"1-3" -> "2-3" [color=blue, labelfontcolor="#009933", fontsize="10.0", penwidth=1];
"1-4" -> "2-3" [color=blue, labelfontcolor="#009933", fontsize="10.0", penwidth=1];
"1-5" -> "2-3" [color=blue, labelfontcolor="#009933", fontsize="10.0", penwidth=1];
"2-4" [width=1, shape=circle, style=filled, fillcolor="#E3A869", label="2-4"];
"1-1" -> "2-4" [color=blue, labelfontcolor="#009933", fontsize="10.0", penwidth=1];
"1-2" -> "2-4" [color=blue, labelfontcolor="#009933", fontsize="10.0", penwidth=1];
"1-3" -> "2-4" [color=blue, labelfontcolor="#009933", fontsize="10.0", penwidth=1];
"1-4" -> "2-4" [color=blue, labelfontcolor="#009933", fontsize="10.0", penwidth=1];
"1-5" -> "2-4" [color=blue, labelfontcolor="#009933", fontsize="10.0", penwidth=1];
"2-5" [width=1, shape=circle, style=filled, fillcolor="#E3A869", label="2-5"];
"1-1" -> "2-5" [color=blue, labelfontcolor="#009933", fontsize="10.0", penwidth=1];
"1-2" -> "2-5" [color=blue, labelfontcolor="#009933", fontsize="10.0", penwidth=1];
"1-3" -> "2-5" [color=blue, labelfontcolor="#009933", fontsize="10.0", penwidth=1];
"1-4" -> "2-5" [color=blue, labelfontcolor="#009933", fontsize="10.0", penwidth=1];
"1-5" -> "2-5" [color=blue, labelfontcolor="#009933", fontsize="10.0", penwidth=1];
}