Presentation on theme: "Dijkstra’s Algorithm and Heuristic Graph Search David Johnson."— Presentation transcript:
Dijkstra’s Algorithm and Heuristic Graph Search David Johnson
DFS and BFS Examples of uninformed graph search –Only metric of quality is number of vertices in path Want to look at difficulty of moving along an edge –Weighted graph –Want the minimum cost path
Dijkstra’s Algorithm Always finds the lowest cost path –For positive edge weight graphs Some subtle differences with breadth-first search Maintains a cost to visit every vertex Looks at the successors of the current lowest cost vertex in the wavefront
Dijkstra’s Outline Initialize a cost array to infinity Set the start vertex cost to 0.0, put in search list Find the minimum cost vertex in searchList For each successor –Compute tentative cost = current cost + edge –If tentative cost < existing cost then overwrite Mark min cost vertex as visited/locked –This has a different meaning than breadth-first Terminate when goal is minimum cost vertex
Example Look at graph in matlab, run through by hand.
Heuristic Search More powerful techniques employ a heuristic –Estimate cost to goal –Expand most promising vertices first –Try to avoid the expanding ring of BFS and Dijkstra
Search Heuristics Heuristic –Informal approach to solving a problem –“rule-of-thumb” –Estimates On a terrain map, what would be an example heuristic for choosing which node to expand?
Greedy Best-First Search Expands the vertex in the search list with the smallest valued estimated cost to goal –Can only use when a meaningful heuristic is available –Ignores the cost so far