Layout of nodes in a tree

Before I go and implement this code myself, I wanted to check if the features in GoLayout could help me do the following:
I have a simple tree with nodes in each level (where each node has only one parent), and when I collapse a node and all its children below are hidden, I would like the tree to “compress” so that other tree nodes can take part of the space vacated by the hidden nodes.
I haven’t experimented much with GoLayout so that’s why I’m asking.
Thanks,
-Eric

Yes, GoLayoutLayeredDigraph will do that for you. But you’ll need to build the GoLayoutNetwork yourself to make sure it doesn’t include any invisible nodes. This is a few lines of code.
However, since the layered-digraph algorithm is fairly general, it’s relatively slow, and it will not handle large graphs in a reasonable amount of time. Depending on the structure, a few hundreds of nodes might be OK.
Alternatively you can just adapt the simple recursive tree layout code provided in the Classier example. That’s extremely fast, and it would be trivial to add the check for invisible nodes.