GoLayout speed and properties

I have two questions.

I’m using GoLayoutLayeredDigraph to automatically lay out the nodes in our app… As the size of the working set gets larger, the call to PerformLayout was taking a veeeerrry long time.

First question: I noticed a marked slowdown even when the number of nodes approached 25 with as many links (drawing times crept up to 3 seconds). With 50 nodes and around 50 links drawing time was getting up into the 10 second range. Is this normal, or should I be looking for some kind misuse on my part? That is, am I abusing GoLayoutLayeredDigraph by not doing something correctly?

Second question: After reading the docs a bit I set the PackOption to

graphLayout.PackOption = GoLayoutLayeredDigraphPack.Straighten | GoLayoutLayeredDigraphPack.Median;

… and noticed a substantial improvement. Just with that small change I was able to layout 250 nodes and about 250 links in about 2 seconds. What are the other ‘big knobs’ that I can turn in order to speed the layout even more? That is, what are the obvious performance tweaks that are typically required to render large numbers of nodes and links quickly (preferably without compromising on the quality of the final layout)? For example, I’ve noticed that setting the Iterations property low has virtually NO impact on the rendering times.

Thanks for the help,

It really depends a lot on the nature of your graph.

There are some graphs for which the LayeringOption of OptimalLinkLength can take a lot of time.

As you’ve discovered, you could try different values for the PackingOption.
Although if you have enough links it will automatically take some or all of those options for you.

Also, do you have disconnected subgraphs? If so, explicitly laying them out separately would be faster. You can use GoLayoutLayeredDigraphNetwork.SplitIntoSubNetworks().

And TreeLayout is a lot faster if that's appropriate for your graph.