在Graphviz中排列等级 [英] Align Ranks in Graphviz

查看:166
本文介绍了在Graphviz中排列等级的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是对方法的后续问题可以对graphviz点进行严格的反向排名吗?,但是要容易一些.该图是人为设计的,但演示了该问题:

This is a follow-up question to How can I achieve strict reverse ranking of graphviz dot?, but a little easier. This graph is contrived, but demonstrates the problem:

digraph nfa {
    A -> B
    B -> C
    C -> D
    D -> E
    A -> F
    F -> E
}

节点B和F具有相同的等级,但是它们不在同一等级上显示.如何做到这一点?

Nodes B and F are the same rank, but they are not displayed at the same rank. How can achieve this?

推荐答案

我将子图与rank = same一起使用,并手动计算等级并将其分组在所述子图中.

I used subgraphs with rank = same, and manually computed the ranks and grouped them in said subgraphs.

digraph {
    { rank = same; A }
    { rank = same; B; F }
    { rank = same; C }
    { rank = same; D }
    { rank = same; E }
    A -> B
    B -> C
    C -> D
    D -> E
    A -> F
    F -> E
}

这篇关于在Graphviz中排列等级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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