What is the best way to implement cost matrix?

When optimizing routes, I needed to create a cost matrix.
After searching the forum, I found several solutions. Which one is more preferable in view of the accuracy and speed of calculations?

  1. Using GreatCircleDistanceCalculator (Haversine)
  1. Using another library or implementing custom solution (for example - Vincenty instead Haversine)
  1. Getting distance & time from graphhopper for every pair of coordinates.

Thanks in advance for your help!

Powered by Discourse