Lecture 12
Introduction to Pathfinding Algorithms
1. What is Pathfinding?
o Pathfinding algorithms are used to determine the shortest or most
efficient path between two points, often within a graph structure.
o These algorithms have applications in various domains including
robotics, logistics, game development, and network routing.
Universal Cost Search (UCS)
1. What is UCS?
o Universal Cost Search (UCS), also known as Dijkstra's algorithm,
is a graph traversal algorithm used to find the shortest path
between a starting node and a target node in a weighted graph.
o UCS explores all possible paths, expanding the least costly path
first.
2. UCS Algorithm
o Step-by-Step Process:
1. Start at the root node and initialize the cost to reach each
node as infinity, except for the starting node which is set to
zero.
2. Expand the node with the lowest cost.
3. Update the cost of reaching neighboring nodes.
4. Repeat the process until the target node is reached or all
nodes have been expanded.
3. Characteristics of UCS
o UCS guarantees finding the shortest path in a graph with non-
negative weights.
o It explores paths based on cumulative cost, ensuring that the path
with the lowest total cost is selected.