Skip to main content
100%

Random Tree

✓ Published0🌍 Public
深深度碎片
Last edited Aug 4, 2016
Created on Aug 4, 2016

A random tree grows in an animated SVG visualization as nodes are added one by one to a random parent. Using d3.layout.tree, the example applies the Reingold-Tilford tidy layout algorithm to recompute positions with each insertion, while entering nodes transition smoothly from their parent’s previous location. The code renders circles and diagonal links via d3.svg.diagonal, and stops once 500 nodes have been added.

AI-generated description

This example builds a random tree using the Reingold-Tilford "tidy" algorithm, as described in "Tidier Drawings of Trees" and implemented by d3.layout.tree. As each node is added to the graph, it enters from the previous position of the parent node. Thus, the existing nodes and the new node transition smoothly to their new positions. The animation stops when 500 nodes have been added to the tree.

forked from <a href='http://bl.ocks.org/mbostock/'>mbostock</a>'s block: <a href='http://bl.ocks.org/mbostock/999346'>Random Tree</a>

gpl-3.0 Licensed

Similar vizzes