How to deal with densely connected graphs with neato
Asked Answered
F

2

12

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 bit of the edge between them.

Frogfish answered 6/10, 2011 at 4:29 Comment(1)
Just found this (#1040285), so my question looks like a duplicate. However, I like the answers to this thread better!Frogfish
B
20

If you add the following to the top of your graph:

overlap=false;
splines=true;

The result is:

graphviz output no overlap with splines

Not only the nodes do not overlap anymore, but also the edges are routed around the nodes.

Bedard answered 6/10, 2011 at 8:26 Comment(0)
C
2

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.

Graph using overlap = false

When I instead insert overlap = scalexy in the same location, I get the following.

Graph using overlap = scalexy

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.

Chaiken answered 6/10, 2011 at 5:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.