JavaScript is required

Custom Force Layout Color Clustering

This example seeds a node-only graph with random positions and random colors, mounts a custom `RGLayouts.ForceLayout` subclass, and makes same-color nodes cluster together on a dark canvas. A floating helper window lets users retune the force parameters, switch canvas interaction modes, and export the current clustered view.

Edit on GraphPilot

Custom Force Layout for Color-Based Node Clustering

What This Example Builds

This example builds a full-screen force-layout playground where many circular nodes drift on a dark canvas and gradually regroup into color-based clusters. The graph starts as an edge-free field of nodes with random positions and random red, yellow, or blue fills, then a custom force solver pulls same-color nodes toward one another.

Users can tune the motion with two sliders, recolor every node with one button,