dfs and bfs traversal methods 797858