Skip to main content
100%

How to D3 Force Directed Layout Graph

✓ Published1🌍 Public
Iisaachowen
Last edited Aug 11, 2019
Created on Aug 11, 2019

This example demonstrates a simple force-directed network graph with three nodes connected by three links, using Game of Thrones houses as node labels. The visualization renders circles and lines in SVG and relies on `d3.forceSimulation` to compute the layout, with `linkDistance(300)` set to space the nodes apart. Node positions update on each tick event, while `force.drag` enables interactive dragging. The code builds nodes and links from a hardcoded array of source-target pairs, stored as plain JavaScript objects, and styles the elements via CSS classes.

AI-generated description
MIT Licensed

Similar vizzes