I forked this simple tree example to demonstrate the very helpful set of each*
each
/ breadth-firsteachAfter
/ post-order traversaleachBefore
/ pre-order traversal traversal methods in d3-hierarchy
.
The d3.tree layout implements the Reingold-Tilford algorithm for efficient, tidy arrangement of layered nodes. The depth of nodes is computed by distance from the root, leading to a ragged appearance. Radial orientations are also supported. Implementation based on work by Jeff Heer and Jason Davies using Buchheim et al.’s linear-time variant of the Reingold-Tilford algorithm. Data shows the Flare class hierarchy, also courtesy Jeff Heer.
Compare to this radial layout.