Factor actual BFS execution into common method.