🌍 Public
Viewing a saved revision (read-only)
48a90c8b291e4d97b023cd7a986892d6
Force Directed Graph Starter
This example demonstrates a minimal force-directed graph with three nodes and two links, where circles and lines are rendered in an SVG container. The nodes (Alice, Bob, Carol) are connected sequentially, and the layout is computed using d3.forceSimulation, with forceManyBody for repulsion, forceLink for link constraints, and forceCenter to keep the graph centered. As the simulation updates, each tick repositions the SVG circles and lines via the simulation’s tick event, updating their cx/cy and x1/y1/x2/y2 attributes. The code imports these specific D3 modules from the d3 package.
AI-generated description