calculate_connectivity function

Method to calculate the Connectivity