Layered digraph parameters for custom arr


Using the default parameters and LayeringOption = GoLayoutLayeredDigraphLayering.LongestPathSource for GoLayoutLayeredDigraph with my diagram I obtain something like:

I would want that the objects a1 and a2 to be placed like a31 so I tried:
LayeringOption = GoLayoutLayeredDigraphLayering.OptimalLinkLength
and I obtained:

But I do not want that the bottom objects to be aligned to the right but to the left as for the first picture:

What parameters should be put to a GoLayoutLayeredDigraph instance to obtain something like this?


It’s fascinating how many different variations there are on what kinds of results people want.
I suppose you can override AssignLayers to call the base method and then traverse the network to look for network nodes that have no destination links (i.e. are “sinks”) and are on the last layer, whatever number that might be. From each such last-layer sink, find the connected “source” with the smallest numbered layer. If that “left-most source”'s layer is greater than zero, then shift that subnetwork down, to the “left”.
In other words, for “b1” there’s only one connected sink, “b”, and its layer is 2, not 0, so shift the connected network “b”/“b1” down/left by 2.


I was hoping for an easy way. I seems that today is not my lucky day
Thanks i will try.