Uniform-cost search
From Wikipedia, the free encyclopedia
Graph search algorithms |
---|
Search |
In computer science, uniform-cost search (UCS) is a tree search algorithm used for traversing or searching a weighted tree, tree structure, or graph. Intuitively, the search begins at the root node. The search continues by visiting the next node which has the least total cost from the root. Nodes are visited in this manner until the goal state is reached. In this manner, uniform-cost search resembles a breadth-first fashion of traversal.
Typically, the search algorithm involves expanding nodes by adding all unexpanded neighboring nodes that are connected by directed paths to a priority queue. In the queue, each node is associated with its total path cost from the root, where the least-cost paths are given highest priority. The node at the head of the queue is subsequently expanded, adding the next set of connected nodes with the total path cost from the root to the respective node.
Uniform-cost search is a special case of Dijkstra's algorithm for general graph searching. Dijkstra's algorithm, in turn, is a special case of the A* search algorithm in which the heuristic is a constant function. Breadth-first search is a special case of uniform-cost search where all edge costs have identical value.