D3v3 Force Layout with Minimum Convex Polygon
A D3v3 force layout displays character co-occurrences from Les Misérables as a network of labeled nodes and gray links, with a translucent green convex hull polygon enclosing the entire graph. The hull updates dynamically as nodes move during simulation, using an intermediate vertex array to compute the polygon boundary. The example combines d3.layout.force for node positioning with d3.geom.hull to calculate the minimum convex polygon around all current node coordinates, rendered as an SVG path with light green fill and steelblue stroke.
AI-generated descriptionA quick example of a minimum convex polygon on a force layout (v3).
Based on this question here, which basically just adds Mike's example convex polygon block to a basic force layout.
I could not quite change the x and y accessor functions, so had to use an intermediate array of vertices.
Here is a d3v4 example.