ravicious / collage

Make simple collages with ease
https://mirrors.link/collage/
GNU General Public License v3.0
3 stars 1 forks source link

A leaf node can never be a left child unless its a sibling of another leaf node #5

Open ravicious opened 2 years ago

ravicious commented 2 years ago

Petgraph doesn't have any notion of "left" and "right" because it's not a library for binary trees but rather a general purpose graph library. Because of that, whatever node gets added as a child first ends up being the left child.

Now, we always create internal nodes first and then fill out remaining space with leaf nodes. As a result of that, a leaf node will never be a left child, unless its a sibling of another leaf node.

This is a problem because we might be missing out on better layouts.

Blueprints don't store leaf nodes, so with blueprints it's not even possible to express a leaf node being a left child.

To fix this problem:

ravicious commented 2 years ago

Now that I think about it, I'm not sure if it's that big of a problem. Changing sides of children won't really change the fitness of a layout, since the available space doesn't change, only the visual layout.