views:

164

answers:

2

I'm halfway there please see the edit

OK here's my problem, I'm generating a graph of a python module, including all the files with their functions/methods/classes.

I want to arrange it so, that nodes gather in circles around their parent nodes, currently everything is on one gargantuan horizontal row, which makes the thing >50k pixels wide and also let's the svg converter fail(only renders about the half of the graph).

I went trough the docs(http://www.graphviz.org/doc/info/attrs.html) but couldn't find anything that seems to do the trick.

So the question is:
Is there a simple way to do this or do I have to layout the whole thing by myself? :/

EDIT:
Thanks to Andrews comment I've got the right layout, the only problem now is that it's a bit to "compact"... so the question now is, how to fix this?

Test

+1  A: 

i've mentioned all of the most significant parameters that influence your current layout and then suggested values for those parameters. Still, i suspect you can get the layout that you want just from applying a couple of these suggestions.

  • reduce the edge weight, eg, [weight=0.5]; this will make the edges longer, causing the tight clusters you currently see in your graph to 'fan out'.

  • get rid of the node borders, node_A [color=none; shape=plaintext]; especially for oval-shaped nodes, a substantial fraction of the total node space is 'unused' (ie, not used to display the node label).

  • explicitly set the font size for the nodes (the node borders are enlarged so that they surround the node text, which means that the font size and amount of text for a given node has a significant effect on its size); [fontsize=11] should be large enough to be legible yet also reduce the 'cluttered' appearance (the default size is 14).

  • increase minimum separation between nodes, via 'nodesep'; eg, nodesep=2.0; this will directly address your objection regarding your graph being "too compact." ('nodesep' and 'ranksep' probably affect how dot draws a graph more than any other parameters for node, edge, or graph. In your case, it looks like you have only two ranks of nodes; 'ranksep' sets the minimum distance between nodes of different ranks--it looks like all of the nodes that comprise your graph are of the same rank (except for few top level nodes in the centers).

  • explicitly set total graph size, eg, size="7.75,10.25" (ensures that your graph fits on an 8.5 x 11 page and that it occupies the entire space)

  • And one purely aesthetic suggestion that at most will only help your graph appear less cluttered: the default fontcolor for both edges and nodes is black. The majority of the ink on your graph is from those two structures (particularly if you remove the node borders), so i would for instance set either the node (text) fontcolor or the edge fontcolor to "blue" to help the eye distinguish the two sets of graph structures.

doug
A: 

If it is too compact, you will want to mess with the edge length. You have a couple options depending on the graph layout:

  1. If your layout is sfdp or fdp, tweak the graph property K. Default is 0.3.
  2. For neato (or fdp), tweak the edge property len. Default is 1.0 for neato and 0.3 for fdp.
  3. For dot you can use the edge property minlen which is the minimum edge length. Default is 1.

You might also want to mess with the graph property model which determines clustering behavior. Specifically, try subset. I believe this handles len for you: http://www.graphviz.org/doc/info/attrs.html#d:model

Also, you can remove overlaps all together with scaling techniques: http://www.graphviz.org/doc/info/attrs.html#d:overlap

spenthil