Is there a limit to the number of nodes and links a D3 force layout can have?

2,401 views
Skip to first unread message

Federicopvs

unread,
Jul 25, 2016, 8:49:35 PM7/25/16
to d3-js
I was wondering if anyone knows examples of D3 force layouts with many nodes. I am working on a huge datasets and, depending on how I filter the data, it would result in graphs with:
  • 2,000 nodes and 15,000 links
  • 11,000 nodes and 16,000 links
  • 12,000 nodes and 200,000 links
  • 30,000 nodes and 671,000

Especially for the last two I am worried the page will take forever to load and that any interactivity (like dragging around or clicking on a node to highlight only other nodes that are directly connected to it) would result in an unusable interface.


Is there a set limit to the number of nodes and links the force layout can handle?

Curran

unread,
Jul 26, 2016, 12:34:39 PM7/26/16
to d3-js
Hello,

The more severe limitation is with SVG, not D3. It varies per machine, but I'd say a reasonable upper limit for the number of SVG elements on the page at a time is around 10,000. This is around where animation gets choppy.

Canvas is much faster than SVG in terms of drawing graphical elements. I'd suggest to try writing some benchmarks with random graphs with many nodes using this Canvas-based example as a starting point: Force Dragging III.

Rendering will probably be the performance bottleneck, not the algorithm itself. This is because the implementation of the force-directed layout algorithm in D3 has asymptotic running time of O(n log n) where n is the number of nodes (according to manyBody.theta docs). I'm not clear though on the running time of the "links" part of the simulation (not specified in the force.links docs).

It would be interesting to compare benchmarks with rendering and without rendering to find the real limits.

Best regards,
Curran

Curran

unread,
Jul 26, 2016, 12:36:32 PM7/26/16
to d3-js
This is another approach for rendering very large graphs - use Web Workers to compute a static layout like in this example Force-Directed Web Worker.
Reply all
Reply to author
Forward
0 new messages