Skip to main content
100%

Random Tree

✓ Published0🌍 Public
Mmbostock
Last edited Feb 26, 2019
Created on May 30, 2011

A random tree grows incrementally as nodes are added to random parents, with the layout recalculated after each insertion using the Reingold-Tilford tidy algorithm via `d3.layout.tree`. Existing nodes and links transition smoothly to their new positions, while entering nodes and links first appear at the parent’s previous coordinates. The SVG animation, driven by a `setInterval` timer, stops after 500 nodes, with node and link styling defined through CSS classes and `d3.svg.diagonal` for curved edges.

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.

gpl-3.0 Licensed

Similar vizzes