converted to igraph. use igraph BFS. Use Counter()