简体   繁体   English

如何允许节点隔开以缩短GraphViz中的边缘?

[英]How can I allow nodes to be spaced out to shorten edges in GraphViz?

I have a digraph with 4 ranks. 我有一个有4个等级的图。 I'm attaching a screenshot. 我要附上屏幕截图。 Very zoomed out, but conveys the idea. 非常缩小,但传达了这个想法。

What I want is to allow the second rank to space out vertically so that the lines between rank 2 and 3 are closer to horizontal. 我想要的是允许第二个等级垂直间隔开,以便等级2和等级3之间的线更接近水平。 Those long lines a very hard to follow! 那些长行很难遵循! I suppose what I'm asking is "how can I prioritise shortening edge length over keeping nodes of the same rank close together?". 我想问的是“相对于保持相同等级的节点靠在一起,如何优先考虑缩短边缘长度?”。

I would include the source but it's very straightforward. 我将包括源代码,但这非常简单。 The relevant bit: 相关位:

digraph tags { rankdir=RL; overlap=false; splines=false;

在此处输入图片说明

Thanks! 谢谢!

You can increase the weight of the edges between ranks 2 and 3 to force these edges to be shorter. 您可以在等级2和3之间增加边缘的权重,以迫使这些边缘变短。 Help the solver by reducing the corresponding weights of the rank 1 to 2 edges. 通过减少等级1到2边缘的相应权重来帮助求解器。

Looking again, I see that you have a cluster around the items in ranks 1 and 2. This causes them to be kept as close together as possible. 再次查看,我发现您在等级1和2的项目周围有一个簇。这使它们尽可能靠近在一起。 Removing the cluster will allow a more relaxed layout and help with the appearance. 删除群集将使布局更加轻松,并有助于外观。 If you need the cluster, you could place invisible nodes between the groups to force them to be more spread out, but you would lose future flexibility in the layout as the hidden nodes could result in unexpected changes in layout. 如果需要群集,则可以在组之间放置不可见的节点,以迫使它们更加分散,但是由于布局不正确,隐藏的节点可能会导致布局的意外更改,因此将来可能会失去布局的灵活性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM