graphviz中用于固定节点位置的边缘布局 [英] edge-layout in graphviz for fixed node positions

查看:250
本文介绍了graphviz中用于固定节点位置的边缘布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图为图形布局编写自己的小算法,该图形布局只能创建节点布局,但是可以没有定义边缘路线.当我使用Graphviz将生成的点文件转换为图形时,边缘是跨越节点甚至彼此重叠的直线.有没有一种方法可以像点算法那样使用Graphviz很好地布局边缘,但是将节点固定在预定的固定位置?

I was trying to write my own little algorithm for graph layout that only creates a node layout but does not define edge routes. When I use Graphviz to turn the resulting dot file into a graph, the edges are straight lines that cross the nodes and even overlap each other. Is there a way to use Graphviz to layout the edges as nicely as the dot algorithm does, but have the nodes in predetermined fixed positions?

您可以在下图上看到实例的效果:

You can see the effect for instance on the following graph:

digraph test {
  "a" [pos="0.0,0.0"];
  "b" [pos="50.0,50.0"];
  "c" [pos="100.0,100.0"];
  "a" -> "b";
  "a" -> "c";
  "b" -> "c";
}

dot -Knop -Tpng -otest.png test.dotty绘制时,a和c之间的线与b交叉.我想要的是所有节点都保持其位置,但是a和c之间的线绕着b.

When drawn with dot -Knop -Tpng -otest.png test.dotty the line between a and c crosses b. What I want is that all nodes keep their positions, but the line between a and c goes around b.

推荐答案

只需添加:

splines=true;

到您的图表-结果是:

这篇关于graphviz中用于固定节点位置的边缘布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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