Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
3 tasks
ravicious opened this issue Nov 10, 2021 · 1 comment
Open
3 tasks

Comments

@ravicious
Copy link
Owner

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.
@ravicious
Copy link
Owner Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant