graph connected components to find phones that are in a group