All Exams Test series for 1 year @ ₹349 only
Question

The state graph shows the action cost along the edges and the heuristic function $h$ associated with each state.

Suppose A* algorithm is applied on this state graph using priority queue to store the frontier. In what sequence are the nodes expanded?

The correct answer is
S,A,E,B,C,D,G

The A* algorithm is a pathfinding and graph traversal algorithm that finds the shortest path from the start node to a goal node using a priority queue. The priority of each node is determined by the function f(n) = g(n) + h(n), where:

  • g(n) is the cost from the start node to node n.
  • h(n) is the heuristic estimate of the cost from node n to the goal.

The node with the lowest f(n) value is expanded first.

Let's calculate the f(n) values for each node as they are expanded:

  1. Start at S: f(S) = g(S) + h(S) = 0 + 6 = 6. Expand node S.
  2. From S, generate A and E:
    • f(A) = g(A) + h(A) = 4 + 2 = 6.
    • f(E) = g(E) + h(E) = 1 + 6 = 7.
    Expand node A next as it has the lowest f(n) value.
  3. From A, generate B:
    • f(B) = g(B) + h(B) = 6 + 2 = 8.
    Expand node E next because it was already generated and has the next lowest value (f(E) = 7).
  4. From E, generate C:
    • f(C) = g(C) + h(C) = 3 + 6 = 9.
    Expand node B as it has f(B) = 8 which is the lowest among remaining nodes.
  5. Continue to expand C, D, and finally G:
    • f(C) = 8 via path S-A-B-C.
    • f(D) = g(D) + h(D) = 9 + 2 = 11.
    • Goal G reached with f(G) = 8 (path: S-E-D-G).

Thus, the sequence of nodes expanded is S, A, E, B, C, D, G.

Was this answer helpful?

Important Questions from Informed Search

  1. Let $h_1$ and $h_2$ be two admissible heuristics used in A* search. 

    Which ONE of the following expressions is always an admissible heuristic?

Need Expert Advice?

Start Your Preparation with Prepp Mobile App

Download the app from Google Play & App Store
Download the app from Google Play & App Store
Prepp Mobile App