I've attatched some images to show what I mean. One shows how the current (not implemented by me) algorithm sorts the nodes. It is very suboptimal as it has a lot of crossings and very cluttering connections. The other picture shows how I rearranged it manually to be way easier to understand. My question now is: How do I figure out the positions for those nodes?
As for the structure of the code:
The last one (with only connections entering on the left side of the node) is the "Root" that has children and each children then also has children etc.
While I wouldn't mind a pre written algorithm, if there isn't one readily available, I'd appreciate some guidance on what steps the algorithm should have.
Thanks in advance!