How to deal with densely connected graphs with neato

Daniel Standage picture Daniel Standage · Oct 6, 2011 · Viewed 8.7k times · Source

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.

Answer

marapet picture marapet · Oct 6, 2011

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.