Speed ​​up d3 strength tuning with many nodes and links

I wanted to create a visualization containing a large number of nodes with a d3 power layout (more than 500 hundred nodes). Despite the fact that it works correctly with as many as 200 nodes, it becomes very slow with about 500, in the sense that the layout hiccups from one frame to another, and events like mouse pointing at nodes are far from reacting. This made me ask a few questions.

  • Is there any limit in the number of nodes after which it is not recommended to use the force composition? If so, is there another library that could handle the job?

  • If I wanted to speed up the process with d3, which parts should be optimized? I tried to keep the css / attributes minimal markup (just gave the radius and fill color for the nodes + the stroke width and the stroke color for the links) and reduce the use of interaction (mouseover events), but can there be another optimization to the force object that contains the whole information? The size of the data should play a role ...

Thanks for your input!

+4
source share
1 answer

One way to do this is to handle not every tick event, but only part of them, for example. skipping the specified number or dynamically adapting the number of events depending on other considerations.

If you need smooth movements, add a transition between the positions set in the processed tick events. You can, of course, combine these ideas and skip events during the transition by processing the first after it is completed.

+2
source

Source: https://habr.com/ru/post/1497773/


All Articles