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 custom gravity applied only to the largest node of each color; compare to standard gravity.