Binary Tree
A visualization of binary trees. The first naive thing you try is a constant offset for the children. Then you realize that the subtrees will immediately overlap.
The second thing you try is breadth-first iteration, where the immediate left or right positions are checked for overlap. If there is an overlap, then call a recursive function that moves nodes away from the desired location. The recursive function moves only horizontally, and can hop subbranches.
This hardly works, because the below position can also be occupied. And even after checking the immediate below, left, and right positions, there are still overlaps. In this graph, the immediate below and immediate next were checked, but not the next step over, so a left node was created with a crossing.
For a given node location, if you want to make a node on the left, you need to find all possible crossings from the top left down to the right at the next level, take those children, and push them left until they are no longer in conflict.
This very nearly works, except that you also need to consider crossing in both directions. Top left down to bottom right, as well as top right down to bottom left, regardless of which direction you are making the next node. So ultimately this is a single function, which we may call untangle, which untangles the tree as the next layer is built.
This works. It's a BFS algorithm that incrementally disentangles the tree at each level as the locations are built. The locations honor the left-right relativity of each node while also avoiding crossings entirely, as you expect from a tree. With all of the conflicts removed, then you finally have a pretty graph. Get creative with generative algorithms.
This was informative. Mentally this feels like unweaving a rope. We will be working with much more complicated graphs, so this iterative disentanglement will be useful for disentangling graphs as maximally as possible, but who still have a minimum number of crossings. This probably has useful applications to circuit design.