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

Better component tiling #223

Open
fedarko opened this issue Mar 9, 2022 · 0 comments
Open

Better component tiling #223

fedarko opened this issue Mar 9, 2022 · 0 comments

Comments

@fedarko
Copy link
Member

fedarko commented Mar 9, 2022

The current, hack-y way isn't great -- it just tiles the components vertically. Ideally we want to pack tiny components (e.g. just one or two nodes) that have relatively smaller bounding boxes horizontally, as well as vertically.

Figuring out an optimal way to do this sounds like a pain, but there are probably some heuristics we can set up.

  • In most graphs, there will be one (or two idk) huge hairball components. We can detect this by seeing if the largest component has, say, at least N% of all nodes in the graph (where N = 20 or something, idk; for massive graphs this will be deceptively small). Anyway, if we make the decision that this largest component is a hairball, tile components in a grid pattern in such a way that the maximum width of any row of the grid is always ≤ the width of this largest component's width. This is analogous to how Bandage handles this.

  • In some small graphs, there won't be a hairball. In this case, maybe just tile components in a grid pattern (starting again with the largest component [determining "largest" by # nodes]), and move on to a new row when the first row contains at least N% of all nodes in the graph. Then set this first row's width as the effective "maximum width" and tile the following rows as before.

Really shouldn't be too bad, at least once #198 is addressed and we can rely on bounding boxes being correct. This doesn't need to be perfect, but it should be at least decent for most graphs.

Once this is done, it might be nice to make some of these settings customizable (e.g. do we tile components from top to bottom or bottom to top? what is N?, etc.). But if we pick good defaults then that's not super important.

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

No branches or pull requests

1 participant