[algorithms][distance] check distance against 0 only when the minimum
distance is updated
Merge pull request #96 from mkaravel/feature/distance

Optimize distance computations for multi-to-multi and single-to-multi