Uniform-cost search (UCS) is a blind graph-search algorithm that expands the node with the lowest cumulative path cost. For maximization problems, it instead prioritizes the highest utility. It finds shortest paths without requiring the entire graph in advance. section 3.2 section 3.4.2
Choosing a route to work
For the quickest route from home to work, breadth-first or depth-first search may reach the destination without minimizing distance. UCS instead explores the route with the lowest accumulated cost, making it suitable for weighted paths. section 3.4
Implement UCS by maintaining a priority queue and updating candidate routes:
- Pop the node with the best priority, expand its children, and accumulate path cost. section 3.4.2
- Expect UCS to behave like BFS when every edge has the same cost. section 3.2
