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

defaultNodeMass returns NaN #18

Open
hillar opened this issue Mar 17, 2021 · 2 comments
Open

defaultNodeMass returns NaN #18

hillar opened this issue Mar 17, 2021 · 2 comments

Comments

@hillar
Copy link

hillar commented Mar 17, 2021

defaultNodeMass returns NaN and Node mass should be a number is thrown

return 1 + links.length / 3.0;

seems that links does not have length but size, as newer graph.getLinks does not return array anymore

as a temporary workaround nodeMass function in physicsSettings helps..

nodeMass : (nodeId) => {
  const links = graph.getLinks(nodeId);
  if (links && links.length) return 1 + links.length / 3.0;
  else if (links && links.size) return 1 + links.size / 3.0;
  else return 1
  }
@anvaka
Copy link
Owner

anvaka commented May 26, 2021

Interesting. What version of the ngraph.graph are you using? I have changed that package but haven't published to npm yet, so that the links storage is different there (moved from array to set).

@hillar
Copy link
Author

hillar commented May 26, 2021

"ngraph.graph": "git+https://github.com/anvaka/ngraph.graph.git#c98822ccc4d9ffb7c1ed5d834a640a19f3a57531",

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