snap connected components