d3-hierarchy icon indicating copy to clipboard operation
d3-hierarchy copied to clipboard

tree layout: Support transparent intermediary nodes to keep the tree tidy

Open arcanis opened this issue 5 years ago • 3 comments

(I opened a question here, but I don't think it's possible under the current core so I don't expect many answers)

The current tree implementation seems to always put children at exactly one depth increment relative to their parent. The problem is that in some pathological cases where one child is much larger than the others, it leads to very wide nodes:

image

Ideally, I would have liked a way in D3 to say that if this situation happens, the heaviest branch are allowed to be shifted at a deeper depth to free the space necessary for the tree width to be shrinked. Basically, I'd like this:

image

Instead of this:

image

arcanis avatar Oct 16 '20 09:10 arcanis

Very interesting idea! Have you built a prototype of this yet?

curran avatar Oct 16 '20 14:10 curran

Unfortunately no, I wouldn't know where to start in to understand the layout algorithm as it's currently implemented 😅

arcanis avatar Oct 16 '20 16:10 arcanis

Looks like something like this is discussed in Tree Drawing Algorithms by Adrian Rusu.

image

curran avatar Oct 16 '20 20:10 curran