edge-layout in graphviz for fixed node positions

妖精的绣舞 提交于 2019-12-21 18:06:18

问题


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";
}

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.


回答1:


Just add:

splines=true;

to your graph - result is:



来源:https://stackoverflow.com/questions/12896348/edge-layout-in-graphviz-for-fixed-node-positions

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!