method added to calculate edges for all cities.