Added edge distance computation