Dijkstra's Algorithm with Chebyshev Distance

I use the Dijkstra Algorithm to find the shortest path in the Graph API defined by Princeton University Algorithm, part 2, and I figured out how to find the path with Chebyshev distance.

Despite the fact that Chebyshev can go to either side of a node with a cost of only 1, it does not affect the total cost, but, according to the schedule, a red circle, why does the path search line move in a zigzag without moving straight?

Will the same thing repeat if I use the A * algorithm?

Red Line should be the theoretically path but the line is going zigzag

+6
source share
2 answers

" ", . - G'(V', E'), V' . , v = (v_prev, v_cur) , v_cur - , v_prev - . " " () .

, , .

+5

, *, , . , , , , , .

Dijkstra A * " ", , , , . , :

  • , , (G F, , Dijkstra *). , , , F-, . .
  • , , , 10 11 . , . : , . , . , ( -, ), .
+2

Source: https://habr.com/ru/post/1016635/


All Articles