Update Path(BFS, DFS)