Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
277 views
in Technique[技术] by (71.8m points)

Placing clusters on the same rank in Graphviz

I would like these two nodes to appear on the same level:

enter image description here

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.

question from:https://stackoverflow.com/questions/6824431/placing-clusters-on-the-same-rank-in-graphviz

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You may simply modify the edge between the routers:

router1 -> router2[constraint=false];

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...