Force-Directed Tree
A randomly generated tree of 1,000 nodes is laid out using D3’s `d3.forceSimulation` with charge, link, and centering forces, and rendered on a Canvas 2D context. The links connect each node to its parent based on a square-root index mapping. The code includes drag interaction via `d3.drag`, allowing users to pin and move nodes. The visualization updates on each simulation tick, redrawing nodes as small circles and links as gray lines on a 960×960 canvas.