BFS map reduce