Depth-first traversal of a tree (source code)

= Depth-first traversal of a tree

A depth-first traversal starts at a root, recursively visits each child subtree, and returns along the entering edge. On a finite <tree>, the resulting closed walk traverses each edge exactly once in each direction.