Process function for BFS returns bool, so that early termination is
possible