如何使用带有样条的neato并避免相互重叠的边缘? [英] how to use neato with spline and avoid mutual edges overlapping?

查看:101
本文介绍了如何使用带有样条的neato并避免相互重叠的边缘?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个约20个节点的有向图,需要固定它们的位置.因此,我正在使用neato生成我的svg文件.问题是,如果使用直线,则边缘会与某些节点重叠.如果集合-Gsplines = true -Gsep = 1,则边缘很好地避开了节点,但它们的相互节点(即a-> b和b-> a的节点)彼此重叠显示... 例如,下面是其中的一部分,其中边缘9-> 12和12->完全重叠. 有谁知道解决这个问题的方法吗?我可以沿与节点交叉的直线走,但是如果我能够避免它们,并让相互的边缘分开显示,那将是理想的选择.不幸的是,由于节点的固定位置是必不可少的,因此不能选择使用普通圆点,因为我的最终目标是将其放置在地图上(我正在用inkscape手工"完成此操作).也赞赏使用其他语言的解决方案(如果可能,还提供示例).

digraph {
7 [width=0.388723, shape=circle, style=filled,pos="-5.3642582,-2.953523!", color="#CCFFFF"];
9 [width=1.02852, shape=circle, style=filled,pos="-9.84668,4.0044438!", color="#CCFF00"];
12 [width=0.337023, shape=circle, style=filled,pos="-9.2490238,1.6804541!", color="#CC9933"];
13 [width=0.315507, shape=circle, style=filled,pos="-7.456055,0.035156!", color="#99FFCC"];
17 [width=0.164396, shape=circle, style=filled,pos="-7.2275394,1.8979026!", color="#33FF99"];

9 -> 7 [penwidth=0.644654, color="#CCFF00"];
9 -> 12 [penwidth=2.04003, color="#CCFF00"];
9 -> 13 [penwidth=1.10067, color="#CCFF00"];
9 -> 17 [penwidth=1.79226, color="#CCFF00"];
12 -> 9 [penwidth=0.5, color="#CC9933"];
12 -> 13 [penwidth=0.75431, color="#CC9933"];
12 -> 17 [penwidth=0.828487, color="#CC9933"];
13 -> 7 [penwidth=0.695661, color="#99FFCC"];
17 -> 13 [penwidth=1.78682, color="#33FF99"];
}

解决方案

特定版本的graphviz可能存在问题-这是我在2.28中获得的输出,并且未显示您提到的问题.

我在图中仅添加了splines=true; sep=1;.

I have a directed graph with ~20 nodes that I need to have their positions fixed. So, I'm using neato to generate my svg file. The problem is that if I use the straight lines, I have edges overlapping some of the nodes. If a set -Gsplines=true -Gsep=1 the edges avoid the nodes nicely but them the mutual nodes (that is, nodes from a -> b and b -> a) are displayed on top of each other... Below is a piece of it, for example, where edges 9 -> 12 and 12 -> are completely overlapped. Does anyone know a way around this? I can go with the straight lines that crosses nodes, but if I can manage to avoid them and have the mutual edges displayed separately, would be ideal. Unfortunately, using plain dot is not an option since the fixed position of the nodes is imperative, since my final goal is to put this on top of a map (which I'm doing "by hand" with inkscape). Solutions in other languages (with examples, if possible), are also appreciated.

digraph {
7 [width=0.388723, shape=circle, style=filled,pos="-5.3642582,-2.953523!", color="#CCFFFF"];
9 [width=1.02852, shape=circle, style=filled,pos="-9.84668,4.0044438!", color="#CCFF00"];
12 [width=0.337023, shape=circle, style=filled,pos="-9.2490238,1.6804541!", color="#CC9933"];
13 [width=0.315507, shape=circle, style=filled,pos="-7.456055,0.035156!", color="#99FFCC"];
17 [width=0.164396, shape=circle, style=filled,pos="-7.2275394,1.8979026!", color="#33FF99"];

9 -> 7 [penwidth=0.644654, color="#CCFF00"];
9 -> 12 [penwidth=2.04003, color="#CCFF00"];
9 -> 13 [penwidth=1.10067, color="#CCFF00"];
9 -> 17 [penwidth=1.79226, color="#CCFF00"];
12 -> 9 [penwidth=0.5, color="#CC9933"];
12 -> 13 [penwidth=0.75431, color="#CC9933"];
12 -> 17 [penwidth=0.828487, color="#CC9933"];
13 -> 7 [penwidth=0.695661, color="#99FFCC"];
17 -> 13 [penwidth=1.78682, color="#33FF99"];
}

解决方案

This may be a problem with a particular version of graphviz - here's the output I get with 2.28, and it doesn't display the problems you mentioned.

I added simply splines=true; sep=1; in the graph.

这篇关于如何使用带有样条的neato并避免相互重叠的边缘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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