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:
[ ] Blueprints need to have a concept of leaf nodes.
[ ] When adding a leaf node to a node with one child already there, there should be a 50% chance for swapping the order of the children.
[ ] Layout crossover should still work with leaf nodes on the left – this requires the blueprint change from the first point.
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.
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: