Skip to main content
100%

Force Layout from CSV

✓ Published0🌍 Public
Mmbostock
Last edited Feb 9, 2016
Created on Jun 18, 2012

This example shows a small force-directed network graph created from a CSV file, with circles representing nodes and lines representing links. It reads the edge list `graph.csv` and builds a node map from the source and target columns. The layout uses the D3 v3 `d3.layout.force` module, rendering with SVG elements. The code loads the CSV with `d3.csv`, then starts the simulation; on each tick, it updates the `x` and `y` coordinates of the circles and lines. Node dragging is enabled via `force.drag`.

AI-generated description

In response to a Stack Overflow question, How to convert to D3's JSON format?.

gpl-3.0 Licensed

Similar vizzes