如何在graphviz中控制节点的放置(即避免边缘交叉) [英] How to control node placement in graphviz (i.e. avoid edge crossings)

查看:169
本文介绍了如何在graphviz中控制节点的放置(即避免边缘交叉)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用graphviz(点)来生成可以在下面看到的图形.左下角的节点(红色椭圆)会引起烦人,因为其边缘与相邻节点的多个边缘交叉.有没有一种方法可以将节点放置在特定区域内?

I'm using graphviz (dot) to generate the graph you can see below. The node in the lower left corner (red ellipse) causes annoyance as its edges cross several edges of the adjacent node. Is there a way to restrain node placement to a certain area?

推荐答案

我不知道有什么方法可以控制单个节点的放置.这真的没有意义,因为要做到这一点,您需要知道最终图形的外观,但是手动放置一个节点会改变其余图形的呈现方式.

I'm not aware of any means by which to control the placement of individual nodes. It doesn't really make sense, because in order to do that you'd need to know what the final graph will look like, yet placing one node manually would then change how the rest of the graph is rendered.

我解决了此问题,方法是更改​​在.dot文件中定义节点的顺序,并在图形级调整nodesepranksep属性.这是一个完善的过程-一次调整一些内容,直到看起来正确为止.

I solved this problem by changing the order in which my nodes are defined in the .dot file, and tweaking the nodesep and ranksep attributes at the graph level. It's a process of refinement - tweaking a few things at a time until it looks right.

您还可以将图形呈现为SVG,然后将其导入Visio(或其他编辑器)并手动重新排列您不满意的节点.

You might also render the graph as SVG, then import it into Visio (or another editor) and manually rearrange the nodes you're not happy with.

这篇关于如何在graphviz中控制节点的放置(即避免边缘交叉)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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