refactored DepthFirstSearch, TestDepthFirstSearch