Calculate similarity of every pair