Another thing worth mentioning occurred to me today. Whoever implements breadth-first - don't get caught out by symlinks. For the depth-first variants, you can just detect them by looking in the stack. For the breadth-first, you won't be able to detect them by looking in the queue that replaced the stack. :)