D3 static performance with forced graphics

So, I am currently trying to create a chart with a force benchmark of several thousand nodes and about 30 thousand links in the chart. As you can guess, the simulation is very slow. Instead, I would like to pre-compromise all positions for the nodes and just render a static (but interactive) graph. Is there a way to use d3.js to compute a gravity plot without rendering it (making it much faster) and then just render the static plot from the pre-calculated values? My code is currently based on the Mike Bostock example.

+2


source to share


1 answer


The d3 method used for force radiation pattern is the standard model of repulsive force and gravity, you can find the pseudocode on Wikipedia (http://en.wikipedia.org/wiki/Force-based_algorithms_%28graph_drawing%29 #Pseudocode) or check it yourself source d3 (https://github.com/mbostock/d3/blob/master/src/layout/force.js).

This algorithm has O (n ^ 2) complexity for each tick (or time slice), and it takes about n ticks to reach equilibrium, to O (n ^ 3) for the entire linking process (http: // www.ecs.umass. edu / ece / labs / vlsicad / ece665 / presentations / Force-Directed-Adel.ppt). For thousands of nodes, this is not practical.




To try and answer your specific question, just use CSS, show: none on your SVG container element. Once the initial "eventually" modeling is over, you can grab the HTML source of the SVG elements and use that as the basis for a static yet interactive presentation. (if you have the html of all the elements, you just need to add a mouse cursor over them for them to display their data.

+1


source







All Articles