Closed jhubble closed 3 years ago
@jhubble The problem was related to the cooling schedule of the algorithm. It is fixed now in the unstable branch and will be available with the next release (hopefully soon). Until then, you can use the unstable branch.
@jhubble Could you please check and confirm the fix for us?
I can confirm that low values for numIter no longer produce an error when using the unstable branch.
However, with a large set, I notice execution time is fairly similar regardless of the number. Even with a numIter as 0, I see a fairly well-formed layout. Should I expect numIter=0 to be similar to a draft layout?
@jhubble The algorithm consists of two parts: draft + iterative. If the quality is default or proof, the algorithm internally sets max number of iterations as max(numIter, 5*number of nodes) to be able to generate satisfying layouts even if numIter is given very low. But if you set the quality as "draft", then it doesn't apply iterative part but just generates a draft layout. I think you can adjust your parameters based on this info.
@hasanbalci can the parameter documentation on the README be updated to reflect the override of numIter? I was under the impression that I could set numIter to a low number to get a fast layout at the expense of quality. However, it appears that numIter functions only as a higher ceiling, not as a lower floor.
good point. @hasanbalci please explain the fact that numIter is a suggested value and might be adjusted by the algorithm as required.
Still error. Please reopen.
@ivansglazunov Could you provide a JSFiddle or JSBin demo to reproduce the issue?
When running a layout with a non-trivial amount of nodes and edges, a RangeError is thrown when using a small number of iterations. If the iteration count is increased, the range error does not appear.
See example on code sandbox. Error is thrown with numIter=20, it works fine with numIter=2000
https://codesandbox.io/s/cytoscape-layout-error-6heez?file=/App.js
Partial stack trace: RangeError: Invalid array length at CoSELayout.FDLayout.calcGrid (VM197 layout-base.js:3678) at CoSELayout.FDLayout.updateGrid (VM197 layout-base.js:3718) at CoSELayout.FDLayout.calcRepulsionForces (VM197 layout-base.js:3434) at CoSELayout.tick (VM196 cose-base.js:1543) at CoSELayout.runSpringEmbedder (VM196 cose-base.js:1580) at CoSELayout.classicLayout (VM196 cose-base.js:1459) at CoSELayout.layout (VM196 cose-base.js:1405) at CoSELayout.Layout.runLayout (VM197 layout-base.js:2659) at coseLayout (VM195 cytoscape-fcose.js:918) at Layout.run (VM195 cytoscape-fcose.js:445)