add support for "external" depth first iterators, which store the 'visited' set