How to find all shortest paths using A * algorithm?

I know that A * algorithm can find the shortest path. But the problem in my work is that I need to find all the shortest paths. More precisely, there may be several shortest paths, but I need to select the shortest path one in priority order clockwise.

If I can get all the shortest paths, I can get one (clockwise priority) that I want.

+3
source share
3 answers

The thing with the A * algorithm is that it is complete and optimal. This means that he will find the path to the solution if there is a path, but also ensures that he first finds the shortest path.

This is due to the fact that the heuristic function A * must be a valid heuristic ; that is, he should not overestimate the distance to the target.

This, in turn, ensures that as soon as you find a path to a solution, you know that in the rest of the search space there are no paths smaller than this.

Let's say that the distance to your first solution was d (problem). Now my last statement actually means that if you keep going only after you find the first solution d (problem) and find another solution, d2 (problem) there are two possibilities:

  • d2 () = d (): , . , d2 = d
  • d2 () > d (): , , : d2. , d2 , . , d2
  • , , d2 () d (), , .

, : , , , . , ( ) , .


" " . , , - . . , : , 0 inf. , [0, 1). , a > b , , a == b , .

, , , . , . , .

, , ( , ). , , , , , , .

+5

, @penelope: "... , ..."

A *:

A * (cost = C *), , OPEN, , C *. ( , , , , .) , , - , 'setup .

A *:

, OPEN. f-, , . ( , , /.) , OPEN, A *.

0

. A * Dijkstra . . ( , , ), A *,

-3

All Articles