Force-Directed Tree
✓ Published0🌍 Public
Mmbostock
Last edited Jun 26, 2019
Created on Apr 25, 2016
A force-directed tree renders 1,000 procedurally generated nodes connected in a hierarchical link pattern, with a force simulation continuously repositioning them. The code uses `d3.forceSimulation` with charge, link, x, and y forces to drive the layout, while drawing to a Canvas 2D context. Nodes appear as small filled circles, and links are stroked lines in gray, with the entire scene offset to the canvas center. Interactive dragging is enabled via `d3.drag`, letting users pull any node and observe the layout rebalance in real time.
AI-generated descriptionThis randomly-generated tree is positioned using a force simulation.
gpl-3.0 Licensed