Use DistanceMatrix interface instead of the concrete implementation