Uniform Cost Search (UCS) Algorithm


When all steps are equal, breadth-first search is optimal because it always expands the shallowest unexpanded node. By a simple extension, we can find an algorithm that is optimal with any step-cost function. Instead of expanding the shallowest node, uniform-cost search expands the node n with the lowest path cost g(n). This is done by storing the frontier as a priority queue ordered by g.

The algorithm is shown in Figure:


Example I:




Assignment I: Solve this problem by using Uniform Cost Search Algorithm


Start Node: Arad
Goal Node: Bucharest
Find The optimal path, if any.