visits the nodes in this order: A B D E C F G
See BreadthFirst for another common way to traverse trees.
Depth first traversals are easy to write in recursive languages because the stack of untaken branches can be implicitly held in the runtime stack.
But fear the day you meet a "tree" with a cycle (loop) in it! In PerlLanguage, "defined caller(50)" offers some advance warning of this.