What does HackerNews think of d3-force?

Force-directed graph layout using velocity Verlet integration.

Language: JavaScript

vis-network is a great library. We actually started with it because we liked the API, the styling capabilities, easy to use event handlers. But we experienced performance issues when we wanted to simulate and render larger graphs because it was done in the main thread, the whole UI was blocked by it. We tried to fix it in vis, but simulation was using DOM so it was super hard to split simulation and renderer.

Actually that was the main reason (along with the note that main authors are not contributing to visjs any more [1]) for a creation of the Orb where we fixed the blocking UI issue with graph simulation. Orb engine has two parts now:

* Simulator that doesn't depend on the DOM so we can move its heavy calculation to the web worker - we use d3-force for it [2]

* Renderer is pretty much influenced by vis-network, using similar style mechanism and canvas drawing capabilities (we credited vis-network in our code for those sections)

[1] https://github.com/almende/vis/issues/4259#issue-412107497

[2] https://github.com/d3/d3-force

That part was straightforward thanks to the "d3-force" plugin for D3.js:

https://github.com/d3/d3-force

I probably ought to spend a little more time tuning the parameters, though.

D3 Version 4 has more utilities and examples of interactions with Canvas. Here's an example of a relatively small graph (~500 nodes, 10k edges) that SVG used to struggle with, but Canvas renders with ease.

http://bl.ocks.org/syntagmatic/954b31aa8b8beb91b30ccb0c9e57f...

Notice the nodes are draggable, an interaction supported by the new simulation.find https://github.com/d3/d3-force/#simulation_find

Hmm. It might be possible, though it doesn’t sound like a great idea to have both D3 3.x and the D3 4.0 default bundle loaded simultaneously, since there will be a lot of overlap. A better strategy might be to load just the new modules you want to use. Like if you just want the new force layout, then load d3-force: https://github.com/d3/d3-force

But it might be best to just migrate to 4.0. I know the changelist is long, but it might not be as hard as you think to migrate. And you can always send your questions to the d3-js Google group or d3.js on Stack Overflow and I’ll try to help.