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

Re-running force-simulation takes nodes farther and farther apart #228

Closed
squidfunk opened this issue Sep 11, 2019 · 1 comment

Comments

@squidfunk
Copy link

commented Sep 11, 2019

Describe the bug

When deleting a node from a cluster or dragging a node, the simulation is being re-run. This, however will move clusters farther and farther apart. It can easily be seen in the dynamic data example. I know that this is more or less related to d3-force-3d and can be mitigated a little by setting a lower value for alpha when re-heating, but it doesn't solve the problem.

To Reproduce
Steps to reproduce the behavior:

  1. Go to the dynamic data example
  2. Wait until some nodes appeared
  3. Remove a central node
  4. Watch how clusters drift further away from each other

Expected behavior

Distribution within the original space without widening the space on every iteration.

Screenshots

Bildschirmfoto 2019-09-11 um 14 01 09

Bildschirmfoto 2019-09-11 um 14 01 14

Anyway, thanks for this awesome demonstration of d3 + three.js!

@squidfunk

This comment has been minimized.

Copy link
Author

commented Sep 11, 2019

I managed to solve my problem by using the radial force and putting clusters of nodes onto different layers, e.g.:

simulation
  .force("center", forceCenter())
  .force("charge", forceManyBody())
  .force("link", forceLink())
  .force("radial", forceRadial(node => 300 / node.weight))

This will move nodes with low weight to the outer edge while keeping nodes with heavier weights in the center.

Ohne Titel (1)

@squidfunk squidfunk closed this Sep 11, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.