Graphviz:集群中的排序节点
Graphviz : Ordering node in a cluster
我正在研究一个自动生成的 Graphviz(因此它需要是一个通用的解决方案,而不是针对这个特定的例子)。它绘制了网络的拓扑结构。但集群内的结果看起来没有组织。
拓扑结构如下:
这是相关代码:
digraph G {
splines=polyline;
subgraph cluster_sh5sl8 {
style=filled;
color=lightgrey;
node [style=filled,color=white];
sh5sl8_L1 [label = "L1"];
label = "5/8";
}
subgraph cluster_sh5sl10 {
style=filled;
color=lightgrey;
node [style=filled,color=white];
sh5sl10_L1 [label = "L1"];
label = "5/10";
}
subgraph cluster_sh5sl12 {
style=filled;
color=lightgrey;
node [style=filled,color=white];
sh5sl12_L1 [label = "L1"];
label = "5/12";
}
subgraph cluster_sh5sl14 {
style=filled;
color=lightgrey;
node [style=filled,color=white];
sh5sl14_L1 [label = "L1"];
label = "5/14";
}
subgraph cluster_sh5sl16 {
style=filled;
color=lightgrey;
node [style=filled,color=white];
sh5sl16_L1 [label = "L1"];
label = "5/16";
}
subgraph cluster_sh6sl3 {
style=filled;
color=lightgrey;
node [style=filled,color=white];
sh6sl3_L1 [label = "L1"];
label = "6/3";
}
subgraph cluster_sh6sl8 {
style=filled;
color=lightgrey;
node [style=filled,color=white];
sh6sl8_L1 [label = "L1"];
label = "6/8";
}
subgraph cluster_sh6sl10 {
style=filled;
color=lightgrey;
node [style=filled,color=white];
sh6sl10_L1 [label = "L1"];
label = "6/10";
}
subgraph cluster_sh6sl12 {
style=filled;
color=lightgrey;
node [style=filled,color=white];
sh6sl12_L1 [label = "L1"];
label = "6/12";
}
subgraph cluster_sh6sl14 {
style=filled;
color=lightgrey;
node [style=filled,color=white];
sh6sl14_L1 [label = "L1"];
label = "6/14";
}
subgraph cluster_sh6sl16 {
style=filled;
color=lightgrey;
node [style=filled,color=white];
sh6sl16_L1 [label = "L1"];
label = "6/16";
}
subgraph cluster_sh30sl1 {
rank=same;
style=filled;
color=lightgrey;
node [style=filled,color=white];
sh30sl1_9600 [label = "9600"]; sh30sl1_9590 [label = "9590"]; sh30sl1_9580 [label = "9580"]; sh30sl1_9570 [label = "9570"]; sh30sl1_9560 [label = "9560"]; sh30sl1_9280 [label = "9280"]; sh30sl1_9270 [label = "9270"]; sh30sl1_9260 [label = "9260"]; sh30sl1_9250 [label = "9250"]; sh30sl1_9220 [label = "9220"]; sh30sl1_9190 [label = "9190"]; sh30sl1_OMD [label = "OMD"];
label = "30/1";
}
sh30sl1_9570 -> sh5sl8_L1;
sh30sl1_9560 -> sh5sl10_L1;
sh30sl1_9280 -> sh5sl12_L1;
sh30sl1_9270 -> sh5sl14_L1;
sh30sl1_9260 -> sh5sl16_L1;
sh30sl1_9220 -> sh6sl3_L1;
sh30sl1_9250 -> sh6sl8_L1;
sh30sl1_9190 -> sh6sl10_L1;
sh30sl1_9600 -> sh6sl12_L1;
sh30sl1_9590 -> sh6sl14_L1;
sh30sl1_9580 -> sh6sl16_L1;
sh6sl12_L1 -> sh30sl1_9600;
sh6sl14_L1 -> sh30sl1_9590;
sh6sl16_L1 -> sh30sl1_9580;
sh5sl8_L1 -> sh30sl1_9570;
sh5sl10_L1 -> sh30sl1_9560;
sh5sl12_L1 -> sh30sl1_9280;
sh5sl14_L1 -> sh30sl1_9270;
sh5sl16_L1 -> sh30sl1_9260;
sh6sl8_L1 -> sh30sl1_9250;
sh6sl3_L1 -> sh30sl1_9220;
}
请注意,我使用的是 FDP,但如果可以的话,我也可以使用其他任何东西。目前,FDP 给了我最好的结果。
如何订购?
我已经尝试过 clusterrank, ranksep, nodesep, constraint=false
,或者以其他顺序调用它们,等等。我尝试创建一个不可抗拒的节点和 link 集群中的每个其他节点以使它们等距,但它没有工作。
我还没有可以处理生成的结果的答案 - 我有一个类似的问题,我可以自己修改 graphviz 文件:
和
<graphviz>
digraph hierachy {
rankdir="LR"
graph [ordering="out"];
subgraph cluster_Hierachie {
label="Hierachie"
n0
n10000
n20000
n30000
n40000
n50000
n0->n10000
n0->n20000
n0->n30000
n0->n40000
n0->n50000
}
}
</graphviz>
呈现为:
到目前为止找到以下链接:
- Preventing graphviz from rearranging nodes
请注意关于如何指定的不同建议"ordering=out"
digraph g {
ordering=out ;
或
digraph bt {
graph [ordering="out"];
none 这些对我有用,尽管 got 1 upvote and 有 2 个赞成票
http://www.graphviz.org/content/ordering-edges
建议使用
rank=same
所以我尝试了:
<graphviz>
digraph hierachy {
rankdir="LR"
graph [ordering="out"];
subgraph cluster_Hierachie {
label="Hierachie"
n0
n10000
n20000
n30000
n40000
n50000
n0->n10000
n0->n20000
n0->n30000
n0->n40000
n0->n50000
{
rank=same;n0;n10000;n20000;n30000;n40000;n50000
}
}
}
</graphviz>
呈现为:
http://www.graphviz.org/content/cluster-changes-nodes-order
建议添加
style=invis
{ rank=same 0 -- 1 [style=invis]
}
节点。我试过了无济于事,最后做了
<graphviz>
digraph hierachy {
rankdir="LR"
graph [ordering="out"];
subgraph cluster_Hierachie {
label="Hierachie"
n0
n10000
n20000
n30000
n40000
n50000
n0->n50000
n0->n40000
n0->n30000
n0->n20000
n0->n10000
}
}
</graphviz>
呈现为:
考虑到集群中反向排序的奇怪行为,我认为这是一个有效的解决方法。
我正在研究一个自动生成的 Graphviz(因此它需要是一个通用的解决方案,而不是针对这个特定的例子)。它绘制了网络的拓扑结构。但集群内的结果看起来没有组织。
拓扑结构如下:
这是相关代码:
digraph G {
splines=polyline;
subgraph cluster_sh5sl8 {
style=filled;
color=lightgrey;
node [style=filled,color=white];
sh5sl8_L1 [label = "L1"];
label = "5/8";
}
subgraph cluster_sh5sl10 {
style=filled;
color=lightgrey;
node [style=filled,color=white];
sh5sl10_L1 [label = "L1"];
label = "5/10";
}
subgraph cluster_sh5sl12 {
style=filled;
color=lightgrey;
node [style=filled,color=white];
sh5sl12_L1 [label = "L1"];
label = "5/12";
}
subgraph cluster_sh5sl14 {
style=filled;
color=lightgrey;
node [style=filled,color=white];
sh5sl14_L1 [label = "L1"];
label = "5/14";
}
subgraph cluster_sh5sl16 {
style=filled;
color=lightgrey;
node [style=filled,color=white];
sh5sl16_L1 [label = "L1"];
label = "5/16";
}
subgraph cluster_sh6sl3 {
style=filled;
color=lightgrey;
node [style=filled,color=white];
sh6sl3_L1 [label = "L1"];
label = "6/3";
}
subgraph cluster_sh6sl8 {
style=filled;
color=lightgrey;
node [style=filled,color=white];
sh6sl8_L1 [label = "L1"];
label = "6/8";
}
subgraph cluster_sh6sl10 {
style=filled;
color=lightgrey;
node [style=filled,color=white];
sh6sl10_L1 [label = "L1"];
label = "6/10";
}
subgraph cluster_sh6sl12 {
style=filled;
color=lightgrey;
node [style=filled,color=white];
sh6sl12_L1 [label = "L1"];
label = "6/12";
}
subgraph cluster_sh6sl14 {
style=filled;
color=lightgrey;
node [style=filled,color=white];
sh6sl14_L1 [label = "L1"];
label = "6/14";
}
subgraph cluster_sh6sl16 {
style=filled;
color=lightgrey;
node [style=filled,color=white];
sh6sl16_L1 [label = "L1"];
label = "6/16";
}
subgraph cluster_sh30sl1 {
rank=same;
style=filled;
color=lightgrey;
node [style=filled,color=white];
sh30sl1_9600 [label = "9600"]; sh30sl1_9590 [label = "9590"]; sh30sl1_9580 [label = "9580"]; sh30sl1_9570 [label = "9570"]; sh30sl1_9560 [label = "9560"]; sh30sl1_9280 [label = "9280"]; sh30sl1_9270 [label = "9270"]; sh30sl1_9260 [label = "9260"]; sh30sl1_9250 [label = "9250"]; sh30sl1_9220 [label = "9220"]; sh30sl1_9190 [label = "9190"]; sh30sl1_OMD [label = "OMD"];
label = "30/1";
}
sh30sl1_9570 -> sh5sl8_L1;
sh30sl1_9560 -> sh5sl10_L1;
sh30sl1_9280 -> sh5sl12_L1;
sh30sl1_9270 -> sh5sl14_L1;
sh30sl1_9260 -> sh5sl16_L1;
sh30sl1_9220 -> sh6sl3_L1;
sh30sl1_9250 -> sh6sl8_L1;
sh30sl1_9190 -> sh6sl10_L1;
sh30sl1_9600 -> sh6sl12_L1;
sh30sl1_9590 -> sh6sl14_L1;
sh30sl1_9580 -> sh6sl16_L1;
sh6sl12_L1 -> sh30sl1_9600;
sh6sl14_L1 -> sh30sl1_9590;
sh6sl16_L1 -> sh30sl1_9580;
sh5sl8_L1 -> sh30sl1_9570;
sh5sl10_L1 -> sh30sl1_9560;
sh5sl12_L1 -> sh30sl1_9280;
sh5sl14_L1 -> sh30sl1_9270;
sh5sl16_L1 -> sh30sl1_9260;
sh6sl8_L1 -> sh30sl1_9250;
sh6sl3_L1 -> sh30sl1_9220;
}
请注意,我使用的是 FDP,但如果可以的话,我也可以使用其他任何东西。目前,FDP 给了我最好的结果。
如何订购?
我已经尝试过 clusterrank, ranksep, nodesep, constraint=false
,或者以其他顺序调用它们,等等。我尝试创建一个不可抗拒的节点和 link 集群中的每个其他节点以使它们等距,但它没有工作。
我还没有可以处理生成的结果的答案 - 我有一个类似的问题,我可以自己修改 graphviz 文件:
和
<graphviz>
digraph hierachy {
rankdir="LR"
graph [ordering="out"];
subgraph cluster_Hierachie {
label="Hierachie"
n0
n10000
n20000
n30000
n40000
n50000
n0->n10000
n0->n20000
n0->n30000
n0->n40000
n0->n50000
}
}
</graphviz>
呈现为:
到目前为止找到以下链接:
- Preventing graphviz from rearranging nodes
请注意关于如何指定的不同建议"ordering=out"
digraph g {
ordering=out ;
或
digraph bt {
graph [ordering="out"];
none 这些对我有用,尽管 got 1 upvote and 有 2 个赞成票
http://www.graphviz.org/content/ordering-edges 建议使用
rank=same
所以我尝试了:
<graphviz>
digraph hierachy {
rankdir="LR"
graph [ordering="out"];
subgraph cluster_Hierachie {
label="Hierachie"
n0
n10000
n20000
n30000
n40000
n50000
n0->n10000
n0->n20000
n0->n30000
n0->n40000
n0->n50000
{
rank=same;n0;n10000;n20000;n30000;n40000;n50000
}
}
}
</graphviz>
呈现为:
http://www.graphviz.org/content/cluster-changes-nodes-order
建议添加
style=invis
{ rank=same 0 -- 1 [style=invis]
}
节点。我试过了无济于事,最后做了
<graphviz>
digraph hierachy {
rankdir="LR"
graph [ordering="out"];
subgraph cluster_Hierachie {
label="Hierachie"
n0
n10000
n20000
n30000
n40000
n50000
n0->n50000
n0->n40000
n0->n30000
n0->n20000
n0->n10000
}
}
</graphviz>
呈现为:
考虑到集群中反向排序的奇怪行为,我认为这是一个有效的解决方法。