How to lay out binary tree / hierarchicy?

I’m trying to visually represent a large-ish binary tree.
Dot is doing a reasonable job except that it won’t keep the pieces of the tree separated - it shoves deeper bits of the tree over underneath shallower parts of the tree.
Neato with mode=hier comes a bit closer, but the output is extremely messy, with everything on a rank overlapping each other, and the children behaving as though I’ve set ranksep to -50% (which I haven’t done, and I don’t think is even possible).

Before I waste a ton of time trying to tweak dot or neato, am I on the right path?
If it were easier to use and programatically feed, and I didn’t mind manually editing or tweaking every file, I might consider using yEd/yFiles for this as its Hierarchical layout mode is almost exactly what I want, but Graphviz is a much better fit for this project architecturally so I really want to make it work instead.

BTW, the graph itself is being output from Python’s NetworkX library using pydot, although it’s simple enough at this stage that I don’t think that matters.

Any help appreciated!

Attaching your input and output would help if that’s possible? Or an anonymised version

Without either input or output, it’s hard to say much. If you can produce canon or dot output type and share it, that would help (recreating your input).

  • One off-the-wall idea: try twopi and circo.
  • A half-baked off-the-wall idea: to stop dot from being to efficient with space, embed each parent node and its children in a cluster - and include subsequent clusters within that cluster.
    I.e. nested clusters out the wazoo.
    I’ve never tried this, but have some hope for the idea.

Greetings. We don’t have a classic tree layout algorithm in graphviz. It would be a nice student project, really, or if the tree is generated by another program you could have it do the layout as well by setting the node positions. Basically you’re just using graphviz as a graphics driver.