在Graphviz中将群集放置在相同级别上 [英] Placing clusters on the same rank in Graphviz

查看:63
本文介绍了在Graphviz中将群集放置在相同级别上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望这两个节点出现在同一级别:

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;
}

我尝试使用rank=samerank=min,但是它们没有给我我所需的东西.

I have tried using rank=same and rank=min, but they aren't giving me what I need.

有趣的是,如果我设置rankdir=LR并注释掉两个路由器到主机的边缘,它可以为我提供想要的外观-但我希望边缘保持完整.

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.

推荐答案

您可以简单地修改路由器之间的边缘:

You may simply modify the edge between the routers:

router1 -> router2[constraint=false];

constraint 指示是否应使用边缘在节点的排名中.

constraint indicates whether the edge should be used in the ranking of the nodes.

这篇关于在Graphviz中将群集放置在相同级别上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆