Use extract() to make depth-first tests more readable.
Introduce DepthFirst::toposort() and accompanying toposort visitor.