0% found this document useful (0 votes)
45 views

A Algorithm

The A* algorithm is an extension of Dijkstra's algorithm that uses a heuristic function to find the optimal path between nodes in a graph more efficiently. It stores nodes in heaps rather than queues and evaluates nodes based on the sum of their distance traveled (g(n)) and estimated distance to the goal (h(n)). Nodes are added to open and closed sets to track evaluation progress.

Uploaded by

Khushi Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views

A Algorithm

The A* algorithm is an extension of Dijkstra's algorithm that uses a heuristic function to find the optimal path between nodes in a graph more efficiently. It stores nodes in heaps rather than queues and evaluates nodes based on the sum of their distance traveled (g(n)) and estimated distance to the goal (h(n)). Nodes are added to open and closed sets to track evaluation progress.

Uploaded by

Khushi Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

A* Algorithm

A* Search Algorithm is a simple and efficient search algorithm that can be used to find
the optimal path between two nodes in a graph. It will be used for the shortest path
finding. It is an extension of Dijkstra’s shortest path algorithm (Dijkstra’s Algorithm). The
extension here is that, instead of using a priority queue to store all the elements, we use
heaps (binary trees) to store them. The A* Search Algorithm also uses a heuristic
function that provides additional information regarding how far away from the goal
node we are.
Open Set: The open set is a collection of nodes that are candidates for evaluation.
Closed Set: The closed set contains nodes that have already been evaluated.

EXAMPLE:

Consider the weighted graph


Node (S-A):

f(A) = g(A) + h(A)= 1 + 3 = 4 // consider

Node (S-G):
f(S-G) = 10 + 0 = 10 // hold

Node (S-A-B):

f(B) = g(B) + h(B)= 3 + 4= 7 //hold

Node (S-A-C):

f(C) = g(C) + h(C)= 2 + 2= 4 //consider

Node (S-A-C-D):

f(D) = g(D) + h(D)= 5 + 6= 11 //hold

Node (S-A-C-G):

f(G) = g(G) + h(G)= 6 + 0= 6 //consider

Thus, the optimal path between the start node to goal node is S-A-C-G

Real-world Applications of the A* Algorithm


• GPS Navigation
• Video Games

You might also like