Add DFS generation implementation