Link Nodes by Name
✓ Published0🌍 Public
Mmbostock
Last edited Jul 3, 2016
Created on Sep 15, 2015
A force-directed graph with six colored nodes and three links demonstrates mapping link endpoints to node identifiers instead of numeric indices. The visualization loads graph.json, which stores node objects with id properties and links referencing those ids as source and target. D3's forceSimulation, forceLink with an id accessor, and forceManyBody position the SVG circles and lines. The code binds data to circle and line elements, sets fill colors from each node's id, and updates positions on every tick event.
AI-generated descriptionThis example shows how to link nodes in a force-directed graph using a named identifier rather than a numeric index.
gpl-3.0 Licensed