Finding the shortest path in the matrix



  • There are cities A, B, C, D, E, F, G. The table shows the prices of tickets from (horizontal axis) to (vertical axis). If there is no need from the city to the same city, the price is 0; If there is no such voyage, it's 1. Find the cheapest way from point A to point B.

    0   10  5   3   20  7   100 
    10  0   7   10  20  7   -1 
    20  10  0   250 10  7   5 
    10  20  6   0   8   10  2 
    3   150 -1  6   0   7   2 
    8   200 5   50  40  0   20 
    120 7   -1  -1  -1  50  0
    


  • Daxtra algorithm




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2