-
Notifications
You must be signed in to change notification settings - Fork 0
Force Layout
A flexible force-directed graph layout implementation using position Verlet integration to allow simple constraints. For more on physical simulations, see Thomas Jakobsen. This implementation uses a quadtree to accelerate charge interaction using the Barnes–Hut approximation. In addition to the repulsive charge force, a psuedo-gravity force keeps nodes centered in the visible area. Links are fixed-distance geometric constraints.

Additional custom forces and constraints may be applied on the "tick" event, simply by updating the x and y attributes of nodes. For example, this can be used to implement multiple foci. The layout algorithm is also extremely robust in dealing with disconnected graphs.
# d3.layout.force()
# force.size([size])
# force.distance([distance])
# force.friction([friction])
# force.charge([charge])
# force.gravity([gravity])
# force.theta([theta])
# force.nodes([nodes])
# force.links([links])
# force.start()
# force.resume()
# force.stop()
# force.on(type, listener)
# force.drag()