BFS, DFS and UCS implementations