Added calculation of pairs and density to global and ego measures