This example generates and visualizes a random tree. It uses a recursive algorithm similar to the simplest one I found in a survey about random trees used in genetic programming (Luke 2001). Hit reload to generate a different tree.
The generated tree has a maximum depth of 10, and for each node branches with a probability of 0.5 yielding at most 6 children.
Leaf nodes (depicted in gray) are placed after internal nodes (in white). The blue label shows an internal node's prefix, i.e. the path from the root node to it.
The implementation is based on this example by Mike Bostock, and customizes d3.js's tree layout to fit my taste.
Modified http://d3js.org/d3.v3.min.js to a secure url
https://d3js.org/d3.v3.min.js