Uniform-Cost Search (UCS) is a best-first search algorithm that systematically explores a weighted graph by always expanding the node with the lowest cumulative path cost from the start node. It uses a priority queue, typically ordered by the g(n) function representing the exact cost from the start to node n, to manage its frontier. This strategy guarantees an optimal solution—the cheapest path—provided all step costs are non-negative, making it a direct generalization of Breadth-First Search (BFS) for graphs with varying edge weights.
