Hi, I'm happy to see that you are finally starting to do something about the branch ordering in Branch Explorer. Ideas about custom weighting/relayout are all good, but in our case we don't want to tweak this manually - we need options that give us a sensible automatic default layout.
We have in total approx 2000 branches and we use attributes to filter the currently/recently active ones (down to approx 60+ branches). I really like the hierarchical Tree View in the Branches view, since our branches are always nested in several levels, like /main/project1/feature1/task1/ or /top_level_release_branch/product1/release1/.
I attached an out-zoomed image of our most recently active branches, with your new experimental layout activated (the green branch is the active workspace) :
As you can see, the many crossing base-links makes it hard to get an overview of how these branches are related to each other in the branch-tree.
With this in mind, it's also clear that having the workspace branch on top is not optimal for us. We'd much rather have a consistent Branch Explorer layout that mimics the hierarchy from the "Branches : Tree View" quite closely, and thus the workspace branch should stay in it's logical position in the tree hierarchy. I understand that the layout problem is not trivial, since child branches are overlapping in time and you still want the graph to be as compact as possible in the vertical direction... However, I think the following rules would fit the bill for us:
* Assume that the Branch Explorer layout is horizontal (as is the default in Plastic).
* For each top-level branch (in alphabetical order, optionally with /main always at the top), put all its immediate child-branches in a separate 2D bounding-box just below that top-level branch.
* Recursively, for each sub-level parent-branch, put all its immediate child-branches in a separate 2D bounding-box just below that parent branch.
* Where sibling-branches are overlapping, arrange them so that their 2D bounding-boxes do not overlap.
* A parent-child link-line should never cross any branch - to achieve this, include the horizontal position of the "Go to branch base" (parent-link) changeset in the 2D bounding-box of each branch!
* (Allow merge arrows to cross branches without restrictions - they need not be taken into account for layout.)
* The 2D bounding-box for each branch should also bound all its (layouted) descendants. NOTE: horizontal bounds are fixed and can be calculated before starting the layout, while vertical bounds depend on the (recursive) vertical arrangement of descendants.
* To layout child-branches, sort them by their "left bound" and always pick the one with the right-most "left bound" available. Greedily place the ones that don't overlap any other sibling horizontally, before stepping down vertically to avoid overlap with the remaining child-branch boxes. Recursively layout each placed branch and update its vertical bound before placing the next one.
While this method may give a slightly larger graph in the vertical direction, I think it will be much more "readable"... Avoiding any overlap of accumulated parent boxes is probably enough for starters and simpler to implement, but overlap testing could be made more advanced by looking at individual leaf bounding boxes. (Basically, once initially placed, a branch with all its descendants could be allowed to "slide" upwards until any of its leaf boxes collide with another leaf box.)