added code for computing the number of edges in each connected components - for scotts request