【发布时间】:2019-05-04 16:34:08
【问题描述】:
我有以下 DOT 代码。它描述了五个子图(集群)。我对两个较低集群的渲染以及集群的相对位置(三个在同一级别的顶部和两个在各自的底部的顺序)感到满意。但是,我希望上面三个集群中的节点根据它们节点的内部关系进行排名,类似于我在下面两个集群中得到的(如您所见,上面集群中的节点都呈现在一个单行,尽管其中一些之间存在隐藏边缘)。
我知道他们不是的原因是rank=same; 命令。但是,如果我删除它,我将失去集群的定位。我尝试了几个变体,使用命令的不同组合和其他命令组合,例如clusterrank=local;,但下面的结果保持最接近。 subgraph cluster ranking in dot 也没有得到我想要的。
digraph G {
splines=line;
size=1;
ranksep=2;
newrank=true;
rankdir=BT
subgraph cluster_z {
label="Z";
rank=same;
"ZSF" [fillcolor = red];
"ZTA" [fillcolor = red];
"ZSS" [fillcolor = red];
"ZIN" [fillcolor = red];
"ZOW" [fillcolor = red];
"ZNT" [fillcolor = red];
"ZSS" [fillcolor = red];
"ZCE" [fillcolor = red];
"ZAY" [fillcolor = red];
"ZNT" [fillcolor = red];
"ZTA" [fillcolor = red];
"ZTA" [fillcolor = red];
"ZST" [fillcolor = red];
"ZTO" [fillcolor = red];
"ZON" [fillcolor = red];
"ZPP" [fillcolor = red];
"TNT" [fillcolor = red];
"TCE" [fillcolor = red];
"TNT" [fillcolor = red];
"ZNT" -> "ZTA" [style=invis]
"ZTA" -> "ZSF" [style=invis]
"ZSF" -> "ZNT" [style=invis]
"ZIN" -> "ZTA" [style=invis]
"ZTA" -> "ZON" [style=invis]
"ZON" -> "ZTA" [style=invis]
"ZTA" -> "ZSF" [style=invis]
"ZSF" -> "ZNT" [style=invis]
"ZNT" -> "ZIN" [style=invis]
"ZPP" -> "ZTA" [style=invis]
"ZTA" -> "ZSF" [style=invis]
"ZSF" -> "ZPP" [style=invis]
"ZSF" -> "ZTA" [style=invis]
"ZTA" -> "ZSF" [style=invis]
"ZOW" -> "ZSS" [style=invis]
"ZSS" -> "ZOW" [style=invis]
"ZAY" -> "ZCE" [style=invis]
"ZCE" -> "ZTA" [style=invis]
"ZTA" -> "ZAY" [style=invis]
"ZSF" -> "ZTA" [style=invis]
"ZAY" -> "ZTA" [style=invis]
"ZTA" -> "ZSF" [style=invis]
"ZAY" -> "ZTA" [style=invis]
"ZTA" -> "ZTA" [style=invis]
"ZTA" -> "ZCE" [style=invis]
"ZCE" -> "ZTA" [style=invis]
"ZTA" -> "ZSF" [style=invis]
"ZSF" -> "ZAY" [style=invis]
}
subgraph cluster_y {
rank=same;
label="Y";
"YCY" [fillcolor = blue];
"YES" [fillcolor = blue];
}
subgraph cluster_w {
rank=same;
label="W";
"WER" [fillcolor = green];
"WRT" [fillcolor = green];
}
subgraph cluster_o {
label="O";
"OOL" [fillcolor = white];
"OOL" [fillcolor = white];
"OIT" [fillcolor = white];
"ONT" [fillcolor = white];
"OGE" [fillcolor = white];
"OTA" [fillcolor = white];
"OTA" [fillcolor = white];
"OTS" [fillcolor = white];
"OTS" [fillcolor = white];
"OCE" [fillcolor = white];
"ORT" [fillcolor = white];
"ORT" [fillcolor = white];
"OON" [fillcolor = white];
"OCT" [fillcolor = white];
"OOL" [fillcolor = white];
"OTO" [fillcolor = white];
"OPE" [fillcolor = white];
"OPY" [fillcolor = white];
"OIT" -> "ORT" [style=invis]
"ORT" -> "OON" [style=invis]
"OON" -> "OPE" [style=invis]
"OPE" -> "OIT" [style=invis]
"OON" -> "OPE" [style=invis]
"OPE" -> "OON" [style=invis]
"OOL" -> "OOL" [style=invis]
"OOL" -> "OOL" [style=invis]
"OCE" -> "OON" [style=invis]
"OON" -> "OCE" [style=invis]
"OTA" -> "OON" [style=invis]
"OON" -> "OTA" [style=invis]
"OIT" -> "OTA" [style=invis]
"OTA" -> "ORT" [style=invis]
"ORT" -> "ORT" [style=invis]
"ORT" -> "OON" [style=invis]
"OON" -> "OIT" [style=invis]
"OIT" -> "OTA" [style=invis]
"OTA" -> "OTS" [style=invis]
"OTS" -> "OON" [style=invis]
"OON" -> "OPE" [style=invis]
"OPE" -> "OIT" [style=invis]
}
subgraph cluster_e {
label="E";
"EUT" [fillcolor = grey];
"EON" [fillcolor = grey];
"ERT" [fillcolor = grey];
"ERT" [fillcolor = grey];
"EST" [fillcolor = grey];
"EON" [fillcolor = grey];
"EER" [fillcolor = grey];
"ERE" [fillcolor = grey];
"ETO" [fillcolor = grey];
}
"OIT" -> "ZSF";
"ORT" -> "ZSF";
"OON" -> "ZSF";
"OPE" -> "ZSF";
"EON" -> "ZSF";
"EER" -> "ZSF";
"OON" -> "ZTA";
"OPE" -> "ZTA";
"EER" -> "ZTA";
"OOL" -> "ZSS";
"OOL" -> "ZSS";
"OGE" -> "ZIN";
"EON" -> "ZIN";
"OOL" -> "ZOW";
"OTS" -> "ZNT";
"OCT" -> "ZSS";
"OCE" -> "ZCE";
"OON" -> "ZCE";
"OTA" -> "ZAY";
"OON" -> "ZAY";
"OIT" -> "ZNT";
"EON" -> "ZNT";
"OIT" -> "ZTA";
"OTA" -> "ZTA";
"ORT" -> "ZTA";
"ORT" -> "ZTA";
"OON" -> "ZTA";
"EON" -> "ZTA";
"ERE" -> "ZTA";
"OIT" -> "ZTA";
"OTA" -> "ZTA";
"OTS" -> "ZTA";
"OON" -> "ZTA";
"OPE" -> "ZTA";
"EON" -> "ZTA";
"ERE" -> "ZTA";
"OOL" -> "ZST";
"OTO" -> "ZTO";
"ONT" -> "ZON";
"EON" -> "ZON";
"OPY" -> "ZPP";
"EER" -> "ZPP";
{ rank=same; "ZSF"; "YCY"; "WER" }
{ rank=same; "OPY"; "EER"}
}
【问题讨论】:
-
您可能需要更详细地描述一下,最好是减少样本,您的意思是 我希望根据内部关系对上三个集群中的节点进行排名他们的节点,类似于我在较低的两个集群中得到的。您的代码非常复杂,需要花费大量时间才能理解,因此准确了解您想去哪里会很有帮助。