impl connected components in undirected graph