How to deal with densely connected graphs with neato
I have the following dot/neato file...
graph G
{
node [color=Red]
r01
r02
r03
r04
r05
r06
r07
r08
r09
r10
r11
node [color=Blue]
p01
p02
p03
p04
p05
p06
p07
p08
p09
p10
p11
p12
p13
r01 -- r02
r01 -- p01
r01 -- p02
r02 -- p01
r02 -- p02
p01 -- p02
r03 -- p03
r04 -- r05
r04 -- p04
r04 -- p05
r04 -- p06
r05 -- p04
r05 -- p06
p04 -- p05
p04 -- p06
r06 -- r07
r06 -- r08
r06 -- r09
r06 -- p07
r06 -- p08
r06 -- p09
r06 -- p10
r06 -- p11
r07 -- r08
r07 -- r09
r07 -- p07
r07 -- p08
r07 -- p09
r07 -- p10
r07 -- p11
r08 -- r09
r08 -- p07
r08 -- p08
r08 -- p09
r08 -- p10
r08 -- p11
r09 -- p07
r09 -- p08
r09 -- p09
r09 -- p10
r09 -- p11
p07 -- p08
p07 -- p09
p07 -- p10
p07 -- p11
p08 -- p09
p08 -- p10
p08 -- p11
p09 -- p10
p09 -- p11
p10 -- p11
r10 -- r11
r10 -- p12
r10 -- p13
r11 -- p12
r11 -- p13
p12 -- p13
}
...from which I create this graphic using neato
.
neato -Tpng -o graph-g.png graph-g.txt
Overall, neato
does a decent job, but the largest connected component in the graph looks pretty ridiculous. What can I do to make this look better? My criteria are that no nodes should overlap and there should be enough distance between connected nodes so that you can see a b开发者_Go百科it of the edge between them.
If you add the following to the top of your graph:
overlap=false;
splines=true;
The result is:
Not only the nodes do not overlap anymore, but also the edges are routed around the nodes.
Graphviz has an overlap
attribute (look for it here) that can sometimes be applied successfully.
When I insert overlap = false
above your first node
attribute the following image is the result.
When I instead insert overlap = scalexy
in the same location, I get the following.
Unfortunately, you still have edges passing through node p11
. Hopefully, a way to address that can also be found.
You can see an example of overlap = false
gone bad near the bottom of this page.
精彩评论