摆脱 graphviz 输入文件中的传递关系
Getting rid of transitive relations in a graphviz input file
我有相对复杂的 graphviz 输入文件,其中包含传递关系。不幸的是,这些使输出过于复杂而没有添加任何附加信息。
有没有什么简单的方法可以从 input/output.
中剥离这些传递关系
示例输入:
digraph main {
subgraph cluster_Session_0 {
color = black;
label = "Session_0";
"Batch_0_0";
}
subgraph cluster_Session_1 {
color = black;
label = "Session_1";
"Batch_1_0" "Batch_1_1" "Batch_1_2" "Batch_1_3" "Batch_1_4";
}
subgraph cluster_Session_2 {
color = black;
label = "Session_2";
"Batch_2_0" "Batch_2_1" "Batch_2_2" "Batch_2_3";
}
subgraph cluster_Session_3 {
color = black;
label = "Session_3";
"Batch_3_0";
}
subgraph cluster_Session_4 {
color = black;
label = "Session_4";
"Batch_4_0";
}
subgraph cluster_Session_5 {
color = black;
label = "Session_5";
"Batch_5_0";
}
subgraph cluster_Session_6 {
color = black;
label = "Session_6";
"Batch_6_0";
}
subgraph cluster_Session_7 {
color = black;
label = "Session_7";
"Batch_7_0";
}
subgraph cluster_Session_8 {
color = black;
label = "Session_8";
"Batch_8_0";
}
subgraph cluster_Session_9 {
color = black;
label = "Session_9";
"Batch_9_0";
}
subgraph cluster_Session_10 {
color = black;
label = "Session_10";
"Batch_10_0";
}
subgraph cluster_Session_11 {
color = black;
label = "Session_11";
"Batch_11_0";
}
subgraph cluster_Session_12 {
color = black;
label = "Session_12";
"Batch_12_0";
}
subgraph cluster_Session_13 {
color = black;
label = "Session_13";
"Batch_13_0";
}
subgraph cluster_Session_14 {
color = black;
label = "Session_14";
"Batch_14_0";
}
"Batch_0_0" -> "Batch_1_0";
"Batch_0_0" -> "Batch_1_0";
"Batch_1_0" -> "Batch_1_1";
"Batch_1_1" -> "Batch_1_2";
"Batch_1_2" -> "Batch_1_3";
"Batch_1_3" -> "Batch_1_4";
"Batch_1_4" -> "Batch_2_0";
"Batch_0_0" -> "Batch_2_0";
"Batch_1_4" -> "Batch_2_0";
"Batch_2_0" -> "Batch_2_1";
"Batch_2_1" -> "Batch_2_2";
"Batch_2_2" -> "Batch_2_3";
"Batch_2_3" -> "Batch_3_0";
"Batch_0_0" -> "Batch_3_0";
"Batch_1_4" -> "Batch_3_0";
"Batch_2_3" -> "Batch_3_0";
"Batch_3_0" -> "Batch_4_0";
"Batch_0_0" -> "Batch_4_0";
"Batch_1_4" -> "Batch_4_0";
"Batch_2_3" -> "Batch_4_0";
"Batch_3_0" -> "Batch_4_0";
"Batch_4_0" -> "Batch_5_0";
"Batch_0_0" -> "Batch_5_0";
"Batch_1_4" -> "Batch_5_0";
"Batch_2_3" -> "Batch_5_0";
"Batch_3_0" -> "Batch_5_0";
"Batch_5_0" -> "Batch_6_0";
"Batch_0_0" -> "Batch_6_0";
"Batch_1_4" -> "Batch_6_0";
"Batch_2_3" -> "Batch_6_0";
"Batch_3_0" -> "Batch_6_0";
"Batch_6_0" -> "Batch_7_0";
"Batch_0_0" -> "Batch_7_0";
"Batch_1_4" -> "Batch_7_0";
"Batch_2_3" -> "Batch_7_0";
"Batch_3_0" -> "Batch_7_0";
"Batch_4_0" -> "Batch_7_0";
"Batch_5_0" -> "Batch_7_0";
"Batch_6_0" -> "Batch_7_0";
"Batch_7_0" -> "Batch_8_0";
"Batch_0_0" -> "Batch_8_0";
"Batch_1_4" -> "Batch_8_0";
"Batch_2_3" -> "Batch_8_0";
"Batch_3_0" -> "Batch_8_0";
"Batch_4_0" -> "Batch_8_0";
"Batch_5_0" -> "Batch_8_0";
"Batch_6_0" -> "Batch_8_0";
"Batch_7_0" -> "Batch_8_0";
"Batch_8_0" -> "Batch_9_0";
"Batch_0_0" -> "Batch_9_0";
"Batch_1_4" -> "Batch_9_0";
"Batch_2_3" -> "Batch_9_0";
"Batch_3_0" -> "Batch_9_0";
"Batch_4_0" -> "Batch_9_0";
"Batch_5_0" -> "Batch_9_0";
"Batch_6_0" -> "Batch_9_0";
"Batch_7_0" -> "Batch_9_0";
"Batch_8_0" -> "Batch_9_0";
"Batch_9_0" -> "Batch_10_0";
"Batch_0_0" -> "Batch_10_0";
"Batch_1_4" -> "Batch_10_0";
"Batch_2_3" -> "Batch_10_0";
"Batch_3_0" -> "Batch_10_0";
"Batch_4_0" -> "Batch_10_0";
"Batch_5_0" -> "Batch_10_0";
"Batch_6_0" -> "Batch_10_0";
"Batch_7_0" -> "Batch_10_0";
"Batch_8_0" -> "Batch_10_0";
"Batch_9_0" -> "Batch_10_0";
"Batch_10_0" -> "Batch_11_0";
"Batch_0_0" -> "Batch_11_0";
"Batch_1_4" -> "Batch_11_0";
"Batch_2_3" -> "Batch_11_0";
"Batch_3_0" -> "Batch_11_0";
"Batch_4_0" -> "Batch_11_0";
"Batch_5_0" -> "Batch_11_0";
"Batch_6_0" -> "Batch_11_0";
"Batch_7_0" -> "Batch_11_0";
"Batch_8_0" -> "Batch_11_0";
"Batch_9_0" -> "Batch_11_0";
"Batch_10_0" -> "Batch_11_0";
"Batch_11_0" -> "Batch_12_0";
"Batch_0_0" -> "Batch_12_0";
"Batch_1_4" -> "Batch_12_0";
"Batch_2_3" -> "Batch_12_0";
"Batch_3_0" -> "Batch_12_0";
"Batch_4_0" -> "Batch_12_0";
"Batch_5_0" -> "Batch_12_0";
"Batch_6_0" -> "Batch_12_0";
"Batch_7_0" -> "Batch_12_0";
"Batch_8_0" -> "Batch_12_0";
"Batch_9_0" -> "Batch_12_0";
"Batch_10_0" -> "Batch_12_0";
"Batch_12_0" -> "Batch_13_0";
"Batch_0_0" -> "Batch_13_0";
"Batch_1_4" -> "Batch_13_0";
"Batch_2_3" -> "Batch_13_0";
"Batch_3_0" -> "Batch_13_0";
"Batch_4_0" -> "Batch_13_0";
"Batch_5_0" -> "Batch_13_0";
"Batch_6_0" -> "Batch_13_0";
"Batch_7_0" -> "Batch_13_0";
"Batch_8_0" -> "Batch_13_0";
"Batch_9_0" -> "Batch_13_0";
"Batch_10_0" -> "Batch_13_0";
"Batch_11_0" -> "Batch_13_0";
"Batch_12_0" -> "Batch_13_0";
"Batch_13_0" -> "Batch_14_0";
"Batch_0_0" -> "Batch_14_0";
"Batch_1_4" -> "Batch_14_0";
"Batch_2_3" -> "Batch_14_0";
"Batch_3_0" -> "Batch_14_0";
"Batch_4_0" -> "Batch_14_0";
"Batch_5_0" -> "Batch_14_0";
"Batch_6_0" -> "Batch_14_0";
"Batch_7_0" -> "Batch_14_0";
"Batch_8_0" -> "Batch_14_0";
"Batch_9_0" -> "Batch_14_0";
"Batch_10_0" -> "Batch_14_0";
"Batch_11_0" -> "Batch_14_0";
"Batch_12_0" -> "Batch_14_0";
}
示例输出:
给定来自名为 test.dot
的文件中问题的示例点源,来自 GraphViz 命令行工具的 tred
工具(有向图的传递减少过滤器)将其减少为线性图以下命令行:
tred test.dot | dot -T png > test.png
结果图像:
我有相对复杂的 graphviz 输入文件,其中包含传递关系。不幸的是,这些使输出过于复杂而没有添加任何附加信息。
有没有什么简单的方法可以从 input/output.
中剥离这些传递关系示例输入:
digraph main {
subgraph cluster_Session_0 {
color = black;
label = "Session_0";
"Batch_0_0";
}
subgraph cluster_Session_1 {
color = black;
label = "Session_1";
"Batch_1_0" "Batch_1_1" "Batch_1_2" "Batch_1_3" "Batch_1_4";
}
subgraph cluster_Session_2 {
color = black;
label = "Session_2";
"Batch_2_0" "Batch_2_1" "Batch_2_2" "Batch_2_3";
}
subgraph cluster_Session_3 {
color = black;
label = "Session_3";
"Batch_3_0";
}
subgraph cluster_Session_4 {
color = black;
label = "Session_4";
"Batch_4_0";
}
subgraph cluster_Session_5 {
color = black;
label = "Session_5";
"Batch_5_0";
}
subgraph cluster_Session_6 {
color = black;
label = "Session_6";
"Batch_6_0";
}
subgraph cluster_Session_7 {
color = black;
label = "Session_7";
"Batch_7_0";
}
subgraph cluster_Session_8 {
color = black;
label = "Session_8";
"Batch_8_0";
}
subgraph cluster_Session_9 {
color = black;
label = "Session_9";
"Batch_9_0";
}
subgraph cluster_Session_10 {
color = black;
label = "Session_10";
"Batch_10_0";
}
subgraph cluster_Session_11 {
color = black;
label = "Session_11";
"Batch_11_0";
}
subgraph cluster_Session_12 {
color = black;
label = "Session_12";
"Batch_12_0";
}
subgraph cluster_Session_13 {
color = black;
label = "Session_13";
"Batch_13_0";
}
subgraph cluster_Session_14 {
color = black;
label = "Session_14";
"Batch_14_0";
}
"Batch_0_0" -> "Batch_1_0";
"Batch_0_0" -> "Batch_1_0";
"Batch_1_0" -> "Batch_1_1";
"Batch_1_1" -> "Batch_1_2";
"Batch_1_2" -> "Batch_1_3";
"Batch_1_3" -> "Batch_1_4";
"Batch_1_4" -> "Batch_2_0";
"Batch_0_0" -> "Batch_2_0";
"Batch_1_4" -> "Batch_2_0";
"Batch_2_0" -> "Batch_2_1";
"Batch_2_1" -> "Batch_2_2";
"Batch_2_2" -> "Batch_2_3";
"Batch_2_3" -> "Batch_3_0";
"Batch_0_0" -> "Batch_3_0";
"Batch_1_4" -> "Batch_3_0";
"Batch_2_3" -> "Batch_3_0";
"Batch_3_0" -> "Batch_4_0";
"Batch_0_0" -> "Batch_4_0";
"Batch_1_4" -> "Batch_4_0";
"Batch_2_3" -> "Batch_4_0";
"Batch_3_0" -> "Batch_4_0";
"Batch_4_0" -> "Batch_5_0";
"Batch_0_0" -> "Batch_5_0";
"Batch_1_4" -> "Batch_5_0";
"Batch_2_3" -> "Batch_5_0";
"Batch_3_0" -> "Batch_5_0";
"Batch_5_0" -> "Batch_6_0";
"Batch_0_0" -> "Batch_6_0";
"Batch_1_4" -> "Batch_6_0";
"Batch_2_3" -> "Batch_6_0";
"Batch_3_0" -> "Batch_6_0";
"Batch_6_0" -> "Batch_7_0";
"Batch_0_0" -> "Batch_7_0";
"Batch_1_4" -> "Batch_7_0";
"Batch_2_3" -> "Batch_7_0";
"Batch_3_0" -> "Batch_7_0";
"Batch_4_0" -> "Batch_7_0";
"Batch_5_0" -> "Batch_7_0";
"Batch_6_0" -> "Batch_7_0";
"Batch_7_0" -> "Batch_8_0";
"Batch_0_0" -> "Batch_8_0";
"Batch_1_4" -> "Batch_8_0";
"Batch_2_3" -> "Batch_8_0";
"Batch_3_0" -> "Batch_8_0";
"Batch_4_0" -> "Batch_8_0";
"Batch_5_0" -> "Batch_8_0";
"Batch_6_0" -> "Batch_8_0";
"Batch_7_0" -> "Batch_8_0";
"Batch_8_0" -> "Batch_9_0";
"Batch_0_0" -> "Batch_9_0";
"Batch_1_4" -> "Batch_9_0";
"Batch_2_3" -> "Batch_9_0";
"Batch_3_0" -> "Batch_9_0";
"Batch_4_0" -> "Batch_9_0";
"Batch_5_0" -> "Batch_9_0";
"Batch_6_0" -> "Batch_9_0";
"Batch_7_0" -> "Batch_9_0";
"Batch_8_0" -> "Batch_9_0";
"Batch_9_0" -> "Batch_10_0";
"Batch_0_0" -> "Batch_10_0";
"Batch_1_4" -> "Batch_10_0";
"Batch_2_3" -> "Batch_10_0";
"Batch_3_0" -> "Batch_10_0";
"Batch_4_0" -> "Batch_10_0";
"Batch_5_0" -> "Batch_10_0";
"Batch_6_0" -> "Batch_10_0";
"Batch_7_0" -> "Batch_10_0";
"Batch_8_0" -> "Batch_10_0";
"Batch_9_0" -> "Batch_10_0";
"Batch_10_0" -> "Batch_11_0";
"Batch_0_0" -> "Batch_11_0";
"Batch_1_4" -> "Batch_11_0";
"Batch_2_3" -> "Batch_11_0";
"Batch_3_0" -> "Batch_11_0";
"Batch_4_0" -> "Batch_11_0";
"Batch_5_0" -> "Batch_11_0";
"Batch_6_0" -> "Batch_11_0";
"Batch_7_0" -> "Batch_11_0";
"Batch_8_0" -> "Batch_11_0";
"Batch_9_0" -> "Batch_11_0";
"Batch_10_0" -> "Batch_11_0";
"Batch_11_0" -> "Batch_12_0";
"Batch_0_0" -> "Batch_12_0";
"Batch_1_4" -> "Batch_12_0";
"Batch_2_3" -> "Batch_12_0";
"Batch_3_0" -> "Batch_12_0";
"Batch_4_0" -> "Batch_12_0";
"Batch_5_0" -> "Batch_12_0";
"Batch_6_0" -> "Batch_12_0";
"Batch_7_0" -> "Batch_12_0";
"Batch_8_0" -> "Batch_12_0";
"Batch_9_0" -> "Batch_12_0";
"Batch_10_0" -> "Batch_12_0";
"Batch_12_0" -> "Batch_13_0";
"Batch_0_0" -> "Batch_13_0";
"Batch_1_4" -> "Batch_13_0";
"Batch_2_3" -> "Batch_13_0";
"Batch_3_0" -> "Batch_13_0";
"Batch_4_0" -> "Batch_13_0";
"Batch_5_0" -> "Batch_13_0";
"Batch_6_0" -> "Batch_13_0";
"Batch_7_0" -> "Batch_13_0";
"Batch_8_0" -> "Batch_13_0";
"Batch_9_0" -> "Batch_13_0";
"Batch_10_0" -> "Batch_13_0";
"Batch_11_0" -> "Batch_13_0";
"Batch_12_0" -> "Batch_13_0";
"Batch_13_0" -> "Batch_14_0";
"Batch_0_0" -> "Batch_14_0";
"Batch_1_4" -> "Batch_14_0";
"Batch_2_3" -> "Batch_14_0";
"Batch_3_0" -> "Batch_14_0";
"Batch_4_0" -> "Batch_14_0";
"Batch_5_0" -> "Batch_14_0";
"Batch_6_0" -> "Batch_14_0";
"Batch_7_0" -> "Batch_14_0";
"Batch_8_0" -> "Batch_14_0";
"Batch_9_0" -> "Batch_14_0";
"Batch_10_0" -> "Batch_14_0";
"Batch_11_0" -> "Batch_14_0";
"Batch_12_0" -> "Batch_14_0";
}
示例输出:
给定来自名为 test.dot
的文件中问题的示例点源,来自 GraphViz 命令行工具的 tred
工具(有向图的传递减少过滤器)将其减少为线性图以下命令行:
tred test.dot | dot -T png > test.png
结果图像: