我正在尝试创建一个图表,我明确指定了许多节点的等级并指定了集群。以下代码生成我想要的图形类型:
digraph {
rankdir=LR
subgraph cluster0 {
"MATH 208"
"MATH 211"
graph [rankdir=LR, style="rounded,filled", color=gray]
}
subgraph year1 {
subgraph {
"MATH 100"
"MATH 110"
graph [rankdir=LR, rank=same]
}
subgraph {
"MATH 101"
"MATH 211"
"MATH 208"
graph [rankdir=LR, rank=same]
}
graph [rankdir=LR]
}
subgraph year2 {
subgraph {
"MATH 205"
"PHIL 203"
graph [rankdir=LR, rank=same]
}
graph [rankdir=LR]
}
subgraph year3 {
subgraph {
"MATH 311"
"MATH 312"
"MATH 375"
graph [rankdir=LR, rank=same]
}
graph [rankdir=LR]
}
subgraph year4 {
subgraph {
"MATH 447"
"MATH 412"
graph [rankdir=LR, rank=same]
}
graph [rankdir=LR]
}
"MATH 100" -> "MATH 101"
"MATH 100" -> "MATH 208"
"MATH 101" -> "MATH 205"
"MATH 110" -> "MATH 311"
"MATH 211" -> "MATH 311"
"MATH 110" -> "MATH 312"
"MATH 211" -> "MATH 312"
"PHIL 203" -> "MATH 375"
"MATH 110" -> "MATH 447"
"MATH 211" -> "MATH 447"
"MATH 311" -> "MATH 412"
"MATH 312" -> "MATH 412"
}
这会产生一个正确的图表,其中“MATH 211”与“MATH 101”的等级相同,但是 graphviz 会发出警告
Warning: MATH 208 was already in a rankset, ignored in cluster pruned
Warning: MATH 211 was already in a rankset, ignored in cluster pruned
如果我从 year1 子图中删除“MATH 211”和“MATH 208”,graphviz 不再抱怨,但结果图不再具有与“MATH 101”相同等级的集群(为什么会......):
有没有办法重新排列/重新排列我的点文件以生成第一个图形但没有任何警告?或者指定某个集群应该与另一个节点处于同一级别?
我应该注意到,该图可以使用 graphviz 2.26 成功编译,但使用 graphviz 2.28 编译失败...