Graphviz same level Vertical Ordering

巧了我就是萌 提交于 2020-02-08 03:26:26

问题


I have a dot graph with many branches. Not sure how to keep the output as the same order while inputing in the script.

Here is my codes,

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"];

 }

In this case, How can I order the bottom level ? You can see that I stated my order in order :

 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"];

I would like to have the order from left to right in

1) cl_b9_data; 
2) cl_b12_data; 
3) cl_b21_data; 
4) cl_b23_data;

Every node needs to have the corresponding arrow. Could anyone please advise ?


回答1:


Simply maintain the order when creating the nodes. Creation happens on the first time a node is named in the source code. Btw braces are not required.

[...]
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"];
[...]


来源:https://stackoverflow.com/questions/40586275/graphviz-same-level-vertical-ordering

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!