Parallel BFS implementation.