Skip to main content
100%

Voronoi Spanning tree - long paths

✓ Published0🌍 Public
PPhilippe Rivière
Last edited Aug 31, 2016
Created on Aug 31, 2016

This example visualizes a Voronoi spanning tree using a dataset of 1,500 randomly generated sites. A red line connects each site to its nearest neighbor in the direction of a user-controlled root point, which follows the mouse cursor. The resulting tree reveals long, winding paths as the connection logic prioritizes proximity to the root over local clustering. Built with d3.v4 and the d3.voronoi API, it renders SVG polygons for the diagram and lines for the spanning tree, updating dynamically on mouse movement.

AI-generated description

Using <a href='http://bl.ocks.org/Fil/1b7ddbcd71454d685d1259781968aefc'>Voronoi.find(x,y)</a> to create a spanning tree.

The strategy is to hop from any site to the next site that is nearest to the designated root (compare with <a href='http://bl.ocks.org/Fil/2d10b09c5c50eee6d311ad5272b95a27'>Voronoi spanning tree - short path</a>).

Original work by Philippe Rivière for d3-voronoi (issue 17).

gpl-3.0 Licensed

Similar vizzes