本文介绍了点中从右到左的边缘(Graphviz)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用点显示从右到左(即向后)的边缘:

I'm trying to display edges going from right to left (i.e. backwards) using dot:

C <- A -> B

我能做的最好的事情是:

The best I could do was:

digraph {
  a -> b;
  c -> a [dir="back"];
  {rank=same;c a b}
}

..这很好,除了我不喜欢在以另一种方式定向边缘时不使用c -> a.

..which is fine, except I don't like using c -> a when the edge is directed the other way.

所以我想分享这个解决方案(SO上似乎没有提到),并检查我是否缺少明显的东西.

So I wanted to share this solution (which didn't seem to be mentioned on SO) and check if I'm missing something obvious.

请参阅: http://www.graphviz.org/doc/info/attrs.html#k:dirType

推荐答案

对于dir的使用,我别无选择,但是我可以将其略短一些,如果您想水平对齐,请使用 rankdir 图形的属性,以强制从左到右的方向.

I have no alternative to your usage of dir, but i can make it slightly shorter, if you want horizontal alignment, use the rankdir property of graph, to force direction from left to right.

digraph {
  rankdir=LR;
  a->b;
  c->a [dir="back"];
}

这篇关于点中从右到左的边缘(Graphviz)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 04:22