在 Graphviz 中将簇放置在相同的等级上
我希望这两个节点出现在同一级别:
digraph G {
subgraph cluster1 {
label="Local Datacenter";
router1;
host1;
}
subgraph cluster2 {
label="Remote Datacenter";
router2;
host2;
}
router1 -> router2;
router2 -> host2;
router1 -> host1;
}
我尝试使用 rank=相同
和rank=min
,但它们没有给我我需要的东西。
有趣的是,如果我设置rankdir=LR并注释掉两个路由器到主机的边缘,它就会给出我想要的外观 - 但我想保持边缘完好无损。
I would like these two nodes to appear on the same level:
digraph G {
subgraph cluster1 {
label="Local Datacenter";
router1;
host1;
}
subgraph cluster2 {
label="Remote Datacenter";
router2;
host2;
}
router1 -> router2;
router2 -> host2;
router1 -> host1;
}
I have tried using rank=same
and rank=min
, but they aren't giving me what I need.
Interestingly, if I set rankdir=LR
and comment out the two router-to-host edges, it gives me exactly the look I want - but I would like to leave the edges intact.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用
newrank
graph 属性(在 GraphViz 2.30 中添加)激活新的排名算法,该算法允许为属于集群的节点定义rank=same
。在顶部添加以下行:
在集群定义之后添加以下行:
这是生成的图表:
You may use the
newrank
graph attribute (added in GraphViz 2.30) to activate the new ranking algorithm which allows definingrank=same
for nodes which belong to clusters.Add the following line at the top:
Add the following line after the cluster definitions:
Here's the resulting graph:
您可以简单地修改路由器之间的边缘:
constraint
指示是否应在节点排序中使用边。You may simply modify the edge between the routers:
constraint
indicates whether the edge should be used in the ranking of the nodes.