Open AydinChavez opened 2 years ago
I had this problem related to using newer ngraph.graph with the offline layout. Depending on the version of ngraph.graph .length
or .size
has to be used, when calculating mass
node_modules/ngraph.forcelayout/index.js: return 1 + (links.length || links.size) / 3.0;
@dholth is correct.
Can you please run the following script to collect versions of your packages?
echo "ngraph.graph" && cat node_modules/ngraph.graph/package.json | grep version
echo "ngraph.offline.layout" && cat node_modules/ngraph.offline.layout/package.json | grep version
echo "ngraph.forcelayout3d" && cat node_modules/ngraph.forcelayout3d/package.json | grep version
echo "ngraph.forcelayout" && cat node_modules/ngraph.forcelayout/package.json | grep version
I do have checks in the current version of the library https://github.com/anvaka/ngraph.forcelayout/blob/04e521d8f7485ffdd3cedbf8469247df7f7f88ae/index.js#L23 and trying my best to figure out the version, but something seem to be missing.
I'm using the graph and forcelayout via unplug.com and I'm seeing the same error with the current versions. Using graph v 19.1.0 works.
graph is 20.0.1 and force layout is 3.3.1.
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8" />
<title>ngraph error</title>
<!-- new version 20.1 of ngraph.graph has a bug when adding an edge. reverting to 19.1.0 for now. -->
<!-- script src="https://unpkg.com/ngraph.graph@19.1.0/dist/ngraph.graph.min.js" --></script>
<script src="https://unpkg.com/ngraph.graph/dist/ngraph.graph.min.js"></script>
<script src="https://unpkg.com/ngraph.forcelayout/dist/ngraph.forcelayout.min.js"></script>
</head>
<body> See console </body>
<script defer>
let g = createGraph();
let l = ngraphCreateLayout(g);
g.addNode('a');
g.addNode('b');
g.addLink('a', 'b'); /* <-- Throws [Error] Error: Node mass should be a number
updateBodyMass (ngraph.forcelayout.min.js:1:5124)
initLink (ngraph.forcelayout.min.js:1:4480)
onGraphChanged (ngraph.forcelayout.min.js:1:3346)
fire (ngraph.graph.min.js:1:8685)
exitModificationReal (ngraph.graph.min.js:1:6575)
addLink (ngraph.graph.min.js:1:3826)
Global Code (127.0.0.1:58)
*/
</script>
</html>
Thanks for the terrific libraries!
Hello @anvaka, first of all thanks a lot for your awesome open source contributions. Really appreciate.
I do have checks in the current version of the library [...] and trying my best to figure out the version, but something seem to be missing.
I also had the same error and i think i know what is the issue:
the latest version of package ngraph.forcelayout3d
(1.2.0
) has dependency "ngraph.forcelayout": "^1.2.0"
.
In that version of ngraph.forcelayout
the check and both functions defaultArrayNodeMass
and defaultSetNodeMass
were not yet implemented.
Hi all,
when using this module as part of layouting the graph via
I get following error:
Any idea how to fix this? This does not happen with ngraph-binary layouting (which had another unrelated sideffects in the result)