What algorithms does D3.js use for the force-direc

2019-03-26 00:44发布

I would be interested to know exactly what algorithms D3 uses to achieve the force-directed graph feature in the library. Having read Kobourov's summary of the history of force-directed graphs left me a bit baffled as to what is the exact algorithm or method (combination of algorithms / heuristics) used in the library.

D3 API reference says Barnes-Hut algorithm is used to calculate the charges acting on bodies, an O(N*log(N)) operation. Kobourov's article mentions that Quigley-Eades algorithm, and Hu's algorithm are multilevel algorithms that make use of Barnes-Hut. Is one of them utilized in some way in D3?

The API wiki futher says Verlet integration is used for particle positioning. The source code mentions Gauss-Seidel algorithm, which in turn is mentioned both in Hu's algorithm and Dwyer's graph layout paper. I guess the question I'm looking an answer to is what "integrative" algorithm D3 utilizes; Kobourov's article lists several and D3 force-directed features don't directly seem to fit any of those.

3条回答
男人必须洒脱
2楼-- · 2019-03-26 01:12

In the original d3 paper, Mike Bostock & al. wrote that Dwyer's implementation is used for the force graph layout :

The force layout combines physical simulation and iterative constraint relaxation [7] for stable graph layout.

[7] T. Dwyer. Scalable, versatile and simple constrained graph layout. In EuroVis, 2009.

For more information, Dwyer's paper describes in details the whole algorithm.

查看更多
SAY GOODBYE
3楼-- · 2019-03-26 01:16

Well, this isn't an answer to your specific question, but on his demo page for force-directed layout, he says, "Layout algorithm inspired by Tim Dwyer and Thomas Jakobsen."

查看更多
霸刀☆藐视天下
4楼-- · 2019-03-26 01:27

An overview of the Force-Layout algorithms can be found at https://github.com/mbostock/d3/wiki/Force-Layout

查看更多
登录 后发表回答