简体   繁体   中英

What algorithms does D3.js use for the force-directed graph?

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.

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.

嗯,这不是你的具体问题的答案,但在他的力导向布局的演示页面上 ,他说,“布局算法受到Tim DwyerThomas Jakobsen的启发。”

可以在https://github.com/mbostock/d3/wiki/Force-Layout上找到Force-Layout算法的概述。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM