in reply to Calculating Shortest Paths with Graph::Directed

This constaint changes the algorithm. For the diagonal elements you want the shortest total path given that you have moved to an adjacent point.

The diagonal distances can be computed from the APSP distance matrix. For E1, the only adjacent vertex is E2 and the distance from E2 back to E1 is 2, so the total distance is 3. For E2, adjacent vertices are a loop to E2 and E3 and the min distance is the loop at one. And so on.

-Mark

  • Comment on Re: Calculating Shortest Paths with Graph::Directed