fix bread first search based detection of connected components in
undirected graphs + tests