Make use of "external" depth-first iterators to avoid revisiting nodes