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

How to use multiple forces at once? #16

Open
micahscopes opened this issue Dec 7, 2023 · 2 comments
Open

How to use multiple forces at once? #16

micahscopes opened this issue Dec 7, 2023 · 2 comments

Comments

@micahscopes
Copy link

micahscopes commented Dec 7, 2023

I'm interested in playing with custom forces, as well as combining in some other graph layout techniques for minimizing edge crossings (stuff like this tabu search layout idea).

Is there a suggested way of combining multiple forces? Should I create multiple Simulations and step through them in a custom event loop? Or is there a shortcut for doing this kind of thing?

@grantshandy
Copy link
Owner

Currently, there isn't any good way to do this AFAIK. You could create a Force that runs each simulation individually inside of it, but that's not so clean. I'm planning on starting the re-write soon, and I'll consider adding support for that 🤔. Thanks!

@micahscopes
Copy link
Author

I've been checking out the changes in the dev branch and I really like the API. It's clean and straightforward. I used it to create an edge-crossing minimizing optimization force that swaps positions of nearby nodes in search of an optimal permutation: https://github.com/micahscopes/cobwebs-2024/blob/main/src/grid_wanderer.rs#L25

The only thing that was a little tricky was that I needed to add a lot of type constraints for the node and edge types in order to get the position swapping to work.

(As far as layout goes, it sort of works but it's not very flexible. It only searches the node position permutation space. I think it'd be good to actually move the nodes themselves around on a grid and search that space instead as well.)

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

2 participants