Graphviz垂直排序 [英] Graphviz Vertical Ordering

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

问题描述

我有一组GraphViz节点,例如:

I have a set of GraphViz nodes such that:

digraph {
    A->B;
    A->C;
    A->D;
}

但是BCD在时间上依次发生!

But B, C, and D happen sequentially in time!

如果有某种方法可以指示每个节点应出现的垂直级别(级别的数量可能事先未知),那就太好了.

It would be great if there was some way to indicate the vertical level each node should appear upon (where the number of levels may be unknown beforehand).

有人对如何做到这一点有想法吗?

Does anyone have thoughts on how to accomplish this?

推荐答案

使节点显示在与其他节点不同的等级(垂直级别)上的一个选项是添加不可见的边缘. 为这些节点分配相同的 group 表示graphviz尽可能将它们布置成一条直线.

One option to have a node display on a different rank (vertical level) than an other node is to add invisible edges. Assigning those nodes the same group indicates graphviz to lay them out in a straight line if possible.

例如:

digraph g{
  A;
 node[group=a];
 B;C;D;
 A -> B;
 A -> C;
 A -> D;
 edge[style=invis];
 B->C->D;
}

另一种选择是使节点(不可见)具有一条垂直线,然后通过使用

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

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