Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to use neato with spline and avoid mutual edges overlapping?

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"];
}
like image 960
Marcelo do Pagode Avatar asked Dec 06 '25 03:12

Marcelo do Pagode


1 Answers

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.

graphviz output

like image 194
marapet Avatar answered Dec 08 '25 17:12

marapet



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!