connected components code in progress