anvaka / anvaka/ngraph.forcelayout
Error: Node mass should be a number
- Dominant language
- JavaScript
- Stars
- 215
- Forks
- 33
- PR merge metrics
- No merged PRs in 30d
Description
Hi all,
when using this module as part of layouting the graph via
```
console.log('Loading graph');
var graph = require('./loadgraph.js')();
console.log('Loaded ' + graph.getNodesCount() + ' nodes; ' + graph.getLinksCount() + ' edges');
var createLayout = require('ngraph.offline.layout');
var layout = createLayout(graph);
console.log('Starting layout');
layout.run();
```
I get following error:
```
Loading graph
Loaded 79566 nodes; 255149 edges
/Users/aydin/Workspace/ngraph_native_suite/node_modules/ngraph.forcelayout/index.js:357
throw new Error('Node mass should be a number')
^
Error: Node mass should be a number
at updateBodyMass (/Users/aydin/Workspace/ngraph_native_suite/node_modules/ngraph.forcelayout/index.js:357:13)
at initBody (/Users/aydin/Workspace/ngraph_native_suite/node_modules/ngraph.forcelayout/index.js:290:7)
at /Users/aydin/Workspace/ngraph_native_suite/node_modules/ngraph.forcelayout/index.js:265:7
at Object.forEachNode (/Users/aydin/Workspace/ngraph_native_suite/node_modules/ngraph.graph/index.js:543:11)
at initPhysics (/Users/aydin/Workspace/ngraph_native_suite/node_modules/ngraph.forcelayout/index.js:264:11)
at Function.createLayout [as get2dLayout] (/Users/aydin/Workspace/ngraph_native_suite/node_modules/ngraph.forcelayout/index.js:35:3)
at createLayout (/Users/aydin/Workspace/ngraph_native_suite/node_modules/ngraph.forcelayout3d/index.js:21:23)
at createLayout (/Users/aydin/Workspace/ngraph_native_suite/node_modules/ngraph.offline.layout/index.js:19:16)
at Object. (/Users/aydin/Workspace/ngraph_native_suite/bin/layout.js:6:14)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
```
Any idea how to fix this? This does not happen with ngraph-binary layouting (which had another unrelated sideffects in the result)
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the layout from bin/layout.js using the graph-loading sequence shown, then inspect ngraph.forcelayout/index.js around updateBodyMass at line 357 and the initBody call stack. Done means layout.run() completes without the Node mass error; the issue also notes comparing behavior with ngraph-binary.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100