fixed generic+DFS+BFS