4

I want to drawing a graph with a huge number of nodes/connected components, but unfortunately Graphviz lays all of connected components side-by-side, and since my connected components consists of only a few nodes, the image looks like this:

n1   n3      n6 n7 n8 n9 n10 n11 n12 ... n999
|     | \           |         |
n2   n4  n5        n13        n13
                    |
                   n14  # all trees have very little heights

so I end up with an image with resolution 500000 x 100 which is really messy to work with.

I'm using default settings for digraph, and my .dot file looks like this:

digraph {
  n1 [ style=dashed; color=grey ];  # I just override node style and color
  ...
  n1 -> n2;
  ...
}

and I use the following to generate an image: dot -Tpng > mygraph.dot

Is it possible to somehow make the layout automatic but specify:

  • max width only, e.g. 8.5 inches, so I can easily break up into letter-size paper pages and print it
  • any size but make width as close to the height (e.g. I want an image of square shape)

?

Edit: E.g. for the case above, I would be hoping for something like:

n1  n6   n8   n10
|        |
n2  n7   n13  n11
         |    |
n3       n14  n13
| \
n4 n5    n9   n12

...

n999
eold
  • 5,972
  • 11
  • 56
  • 75
  • 1
    possible duplicate of [How to control subgraphs' layout in dot?](http://stackoverflow.com/questions/8002352/how-to-control-subgraphs-layout-in-dot) – marapet May 02 '14 at 07:42
  • 1
    [This answer](http://stackoverflow.com/a/8003622/63733) shows how to arrange disconnected graphs. – marapet May 02 '14 at 07:45

0 Answers0