Graphviz相同级别垂直排序

时间:2016-11-14 10:14:36

标签: graphviz dot

我有一个包含许多分支的点图。在脚本中输入时不确定如何将输出保持为相同的顺序。

这是我的代码,

digraph {

 "/home2/groups/" -> Data;
 CL[label="CL(9+12)"];
 CA[label="CA(14+5)"]
 Data -> CL;
 Data -> CA;
 CL -> Cl_batch1;
 CL -> Cl_batch2;
 CA -> CA_batch1;
 CA -> CA_batch2;
 CA_batch1 -> {ca_a0 [label="G_pipeline"]};
 CA_batch1 -> {ca_a1[label="Phe"]};
 CA_batch1 -> {ca_a2 [label="QC"]};
 CA_batch2 -> {ca_a0 [label="G_pipeline"]};
 CA_batch2 -> {ca_a1 [label="Phe"]};
 CA_batch2 -> {ca_a2 [label="QC"]};
 Cl_batch1 -> {cl_b0 [label="G_pipeline"]};
 Cl_batch1 -> {cl_b1 [label="Phe"]};
 Cl_batch1 -> {cl_b2 [label="QC"]};
 Cl_batch2 -> {cl_b0 [label="G_pipeline"]};
 Cl_batch2 -> {cl_b1 [label="Phe"]};
 Cl_batch2 -> {cl_b2 [label="QC"]};
 {cl_b3[label="Ge"]};
 cl_b0 -> cl_b3;
 {cl_b4[label="cfv"]}; {cl_b5[label="combined_Gcfv"]}; {cl_b6[label="combined_cfv"]}; {cl_b7[label="vq"]};
 {cl_b8[label="batch"]};
 cl_b3 -> {cl_b4;cl_b5;cl_b6;cl_b7[color=green]};
 {cl_b4;cl_b5;cl_b6;cl_b7} -> cl_b8;
 {cl_b9_data[label="9wL/woL"]};
 {cl_b12_data[label="12wL/woL"]};
 {cl_b21_data[label="21wL/woL"]};
 {cl_b23_data[label="23(+misc)wL/woL"]};
 cl_b8 -> cl_b9_data[label="typeA"];
 cl_b8 -> cl_b12_data[label="typeB"];
 cl_b8 -> cl_b21_data[label="typeA+typeB"];
 cl_b8 -> cl_b23_data[label="typeA+typeB"];

 ### CA_batch1 & CA batch2
 {ca_a3[label="Ge"]};
 ca_a0 -> ca_a3;
 {ca_a4[label="cfv"]}; {ca_a5[label="combined_Gcfv"]}; {ca_a6[label="combined_cfv"]}; {ca_a7[label="vq"]};
 {ca_a8[label="batch"]};
 ca_a3 -> {ca_a4;ca_a5[color=green];ca_a6[color=green];ca_a7[color=green]}
 {ca_a4;ca_a5;ca_a6;ca_a7} -> ca_a8;
 ca_a8 -> {ca_a14_data[label="14wL/woL"]}[label="typeA"];
 ca_a8 -> {ca_a_5_data[label="5wL/woL"]}[label="typeC"];
 ca_a8 -> {ca_a19_data[label="19wL/woL"]}[label="typeA/typeC"];

 }

enter image description here

在这种情况下,我如何订购底层? 你可以看到我按顺序说明了我的订单:

 cl_b8 -> cl_b9_data[label="typeA"];
 cl_b8 -> cl_b12_data[label="typeB"];
 cl_b8 -> cl_b21_data[label="typeA+typeB"];
 cl_b8 -> cl_b23_data[label="typeA+typeB"];

我想在

中从左到右订购
1) cl_b9_data; 
2) cl_b12_data; 
3) cl_b21_data; 
4) cl_b23_data;

每个节点都需要有相应的箭头。有人可以建议吗?

1 个答案:

答案 0 :(得分:0)

创建节点时只需维护顺序即可。创建发生在源代码中第一次命名节点时。顺便说一句不是必需的。

[...]
clo_b9_I   [label="9wL"];
clo_b12_I  [label="12wL"];
clo_b21_I  [label="21wL"];
clo_b23_I  [label="23wL"];
clo_b9_woL [label="9woL"];
clo_b12_woL[label="12woL"];
clo_b21_woL[label="21woL"];
clo_b23_woL[label="23woL"];
[...]