find connected component and all metrics