如何强制graphviz始终生成相同的布局?
给出一个图表:
digraph {
subgraph clusterA {
subgraph clusterB {
"B.001"
"B.002"
"B.003"
"B.004"
}
subgraph clusterC {
"C.001"
"C.002"
"C.003"
}
}
subgraph clusterD {
subgraph clusterE {
"E.001"
}
subgraph clusterF {
"F.001"
"F.002"
"F.003"
}
subgraph clusterG {
"G.001"
"G.002"
}
}
subgraph clusterH {
"H.001"
}
"G.002" -> "F.003"
"F.001" -> "C.003"
"G.002" -> "F.002"
"G.002" -> "D.001"
}
显然第一个看起来好多了,我希望graphviz坚持这个。
我尝试将图表传递到fdp
和unflatten
,但它不会改变任何内容。
答案 0 :(得分:0)
我尝试了很多不同的在线渲染解决方案和cli。我看不到另一个输出然后你的第二个。但如果您更喜欢第一个,只需切换ClusterB和ClusterC的顺序。
digraph {
rankdir=TB
subgraph clusterA {
subgraph clusterC {
"C.001"
"C.002"
"C.003"
}
subgraph clusterB {
"B.001"
"B.002"
"B.003"
"B.004"
}
}
subgraph clusterD {
subgraph clusterE {
"E.001"
}
subgraph clusterF {
"F.001"
"F.002"
"F.003"
}
subgraph clusterG {
"G.001"
"G.002"
}
}
subgraph clusterH {
"H.001"
}
"G.002" -> "F.003"
"F.001" -> "C.003"
"G.002" -> "F.002"
"G.002" -> "D.001"
}