A* Search Algorithm Exercise
Target node First Steps From Start Node
9 5 0 → 1 (and) 0 → 3
5 6
2 1 2 1. 0 → 1 = f(n) = g(n) + h(n)
6
7 4 = 2 + 16 = 18
0
2. 0 → 3 = f(n) = g(n) + h(n)
6 3 10
Start node
= 6 + 10 = 16
Target node
9 5
5 6
2 1 2
6
7 4
0
6 3 10 Second Steps
Start node
0 → 1 → 2 (and) 0 → 3 → 4 (and) 0 → 3 → 2
1. 0 → 1 → 2 = f(n) = g(n) + h(n)
= (2+5) + 6 = 13
2. 0 → 3 → 4 = f(n) = g(n) + h(n)
= (6+10) + 4 = 20
3. 0 → 3 → 2 = f(n) = g(n) + h(n)
= (6+7) + 6 = 19
Target node Third Steps
9 5 0 → 1 → 2 → 5 (and) 0 → 3 → 4 → 5 (and)
5 6
2 1 2 0→3→2→5
6
7 4 1. 0 → 1 → 2 → 5 = f(n) = g(n) + h(n)
0
= (2+5+9) + 0 = 16
6 3 10
Start node
2. 0 → 3 → 4 → 5 = f(n) = g(n) + h(n)
= (6+10+6) + 0 = 22
3. 0 → 3 → 2 → 5 = f(n) = g(n) + h(n)
= (6+7+9) + 0 = 22
Final selected paths to reach Target node : 0 → 1 → 2 → 5 (or) 0 → 3 → 4 → 5 (or) 0 → 3 → 2 → 5
The Shortest Path is 0 → 1 → 2 → 5.