On 08/08/2011 05:03 PM, Steffen Schaper wrote:
I think I found a way forward - may not be perfect, but works for the time being.
It looks like pin only works with neato and fdp - see http://www.graphviz.org/doc/info/attrs.html#d:pin
So I added layout='neato' to graph_draw, and that seems to do the trick.
The graph_draw() function defaults to 'neato' if the graph is smaller than 1000 nodes, and uses 'sfdp' otherwise. And indeed, it seems like 'sfdp' ignores the pin property. This is a graphviz limitation.
Unfortunately, the canvas size seems to change (even though I specified size=(15,15) for the initial layout and for the later call). My current workaround is to simply redraw the graph with neato and overwrite the output file.
Unfortunately, graphviz gives very little control on the total canvas size, and likes to crop things. I find it very annoying, but I don't know how to force graphviz to do the right thing.
One thing that suprised me is that pinning doesn't make things any faster. My network has almost 10000 nodes - does it really take most of the time to create output rather than performing the actual layout?
I notice a _huge_ difference when running 'neato' with pinning vs. without. But maybe you can improve things further by limiting the total number of iterations with the 'maxiter' parameter.