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

假如想象 提交于 2019-12-04 18:15:30

问题


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.


回答1:


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.




回答2:


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."




回答3:


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



来源:https://stackoverflow.com/questions/12917037/what-algorithms-does-d3-js-use-for-the-force-directed-graph

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!