BFS and Inversion