2. A*Definition:
A* is a computer algorithm that is widely used in
path finding and graph traversal. The algorithm
efficiently plots a walk able path between multiple
nodes, or points, on the graph.
Step:
1.A* makes use of a priority with the element
stored being the path from the start state to a
particular node, but the priority of an element is
not the same.
2.In A* we use the cost of getting to a node plus
the heuristic value at that point as the priority.
3. 3. Insert the root node into the queue
4.Check the queue empty or not. if not empty
Dequeue the element with the highest priority
5.when the path is ending at the goal state, print
the path and exit otherwise insert all the children of
the dequeued element, with f(n) as the priority .
Here we use the equation ,
f(n) = g(n) + h(n)
f(n) indicate the n node priority , g(n) indicate the
cost from n node to any other node, h(n) indicate
the heuristic value of n node.
5. Now
We know,
f(n) = g(n) + h(n)
So
A=0+10=10
A->B = 2+7 =9
A -> D = 1+6 =7
So lowest value is ‘7’ so we take the path
A -> D
6. Again
A -> D -> C = (1+5)+5 =11
A-> D -> E = (1+8)+4 =13
Also we have A->B = 2+7 =9
So the lowest value is ‘9’ .so we take the path
A->B
Again
A->B->C = (2+3)+5=10
So the lowest value is ‘10’ .so we take the path
A->B->C
7. Again
A -> B -> C -> F = (2+3+6)+0=11
So we reach the goal node. for this cost is
‘11’ .
Now we have
A -> D -> C = (1+5)+5 =11
A-> D -> E = (1+8)+4 =13
So the lowest value is ‘11’ .so we take the
path A -> D -> C
8. Again
A -> D -> C -> F= (1+5+6)+0=12
So we reach the goal node. for this cost is
‘12’ .
Now we have
A-> D -> E = (1+8)+4 =13
So the lowest value is ‘13’ .so we take the
path A-> D -> E
9. Again
A-> D -> E -> F = (1+8+7)+0=16
So we reach the goal node. for this cost is
‘16’ .
So from source node to goal node the
minimum cost is ‘11’ because 11<12<16.
So the path is A -> B -> C -> F