Update ComputePairwise.py

Fixed memory issue in cutting links. Made utility function calculate more efficiently.