Skip to main content
100%

Clustered Force Layout I

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

This clustered force layout visualizes 200 circles organized into 10 color-coded clusters, with each circle’s size varying by cluster. The d3.v3 force layout uses two custom forces: a cluster force that pulls circles toward the largest node of the same color, and a collide force using d3.geom.quadtree to prevent overlaps. Circle separation differs between same-color and different-color pairs. The SVG rendering updates circle positions on each tick event, with colors assigned via d3.scale.category10.

AI-generated description

This clustered force layout is implemented using two custom forces. The first, cluster, pushes nodes towards the largest node of the same color. A second collide force prevents circles from overlapping by detecting collisions.

This example uses standard gravity; compare to custom gravity applied only to the largest node of each color. To minimize distracting jitter during initialization, try an entry transition.

gpl-3.0 Licensed

Similar vizzes