Know the difference between A* and Dijkstra's algorithm (pp. 241-243)

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

 Know the difference between A* and Dijkstra's algorithm (pp. 241-243)

Cost = AccumulativeCostTo(E.From) + E.Cost + Cost To (Target)
Utilizing a heuristic in this way, the modified costs direct the search toward
the target node instead of radiating outward equally in all directions. This
results in fewer edges needing to be examined, thereby speeding up the
search and is the primary difference between A* and Dijkstra's algorithm.
NOTE If you set the heuristic cost to zero in A", the resulting search behaves
exactly the same as Dijkstra's algorithm.
Let's take a peek at how A* operates on the problem graphs used in the
PathFinder program.
A* in Action
Screenshot 5.8 shows the result of A* operating on the simple source-target
example problem. As you can see, no extraneous edges have been consid-
ered, and the path leads directly to the target. The heuristic function used is
the straight-line distance between two nodes.
Time Claped for A Sanchis 5.96-005
Graph Search Algorithms
♫
Screenshot 5.8. Do not pass Go, do not collect £200.
Time laped for each
351 06
Screen shot 5.9
Screen shot 5.9 is just as impressive. Observe how few edges the A* algo-
rithm had to consider before finding the target. As a consequence of this,
the time taken to perform the search is considerably less than for any of the
other searches (even though an evil square root is required to calculate the
heuristic cost).
HJ
H210 E: 1220
TLFEBOOK
The Secret Life of Graphs | 243
NOTE A* is proven to be optimally efficient. In other words, no other search
algorithm will expand fewer nodes in the quest for the least cost path between
source and target.
Transcribed Image Text:Cost = AccumulativeCostTo(E.From) + E.Cost + Cost To (Target) Utilizing a heuristic in this way, the modified costs direct the search toward the target node instead of radiating outward equally in all directions. This results in fewer edges needing to be examined, thereby speeding up the search and is the primary difference between A* and Dijkstra's algorithm. NOTE If you set the heuristic cost to zero in A", the resulting search behaves exactly the same as Dijkstra's algorithm. Let's take a peek at how A* operates on the problem graphs used in the PathFinder program. A* in Action Screenshot 5.8 shows the result of A* operating on the simple source-target example problem. As you can see, no extraneous edges have been consid- ered, and the path leads directly to the target. The heuristic function used is the straight-line distance between two nodes. Time Claped for A Sanchis 5.96-005 Graph Search Algorithms ♫ Screenshot 5.8. Do not pass Go, do not collect £200. Time laped for each 351 06 Screen shot 5.9 Screen shot 5.9 is just as impressive. Observe how few edges the A* algo- rithm had to consider before finding the target. As a consequence of this, the time taken to perform the search is considerably less than for any of the other searches (even though an evil square root is required to calculate the heuristic cost). HJ H210 E: 1220 TLFEBOOK The Secret Life of Graphs | 243 NOTE A* is proven to be optimally efficient. In other words, no other search algorithm will expand fewer nodes in the quest for the least cost path between source and target.
Graph Search Algorithms
diagonal edges cost more to traverse than horizontal or vertical ones. With
this in mind you can see how the algorithm has searched a similar distance
in every direction before reaching the target.
Screenshot 5.7 shows Dijkstra's algorithm operating on the more com-
plex map.
H²
Time Espod for Dia's Search is 0.000274
Screenshot 5.7
The Secret Life of Graphs | 241
H210 1220
Like the BFS, Dijkstra's algorithm examines an awful lot of edges.
Wouldn't it be great if the algorithm could be given hints as it progresses to
nudge the search along in the correct direction? Well, luckily for us, this is
possible. Ladies and gentlemen, please put your hands together in a round
of applause and welcome A*!
242 Chapter 5
Dijkstra with a Twist: A*
Dijkstra's algorithm searches by minimizing the cost of the path so far. It
can be improved significantly by taking into account, when putting nodes
on the frontier, an estimate of the cost to the target from each node under
consideration. This estimate is usually referred to as a heuristic, and the
name given to the algorithm that uses this method of heuristically directed
search is A* (pronounced ay-star). And jolly good it is too!
If the heuristic used by the algorithm gives the lower bound on the
actual cost (underestimates the cost) from any node to the target, then A* is
guaranteed to give optimal paths. For graphs that contain spatial informa-
tion, such as navigation graphs, there are several heuristic functions you
can use, the most straightforward being the straight-line distance between
the nodes in question. This is sometimes referred to as the Euclidean
distance.
TLFEBOOK
Graph Search Algorithms
A* proceeds in an almost identical fashion to Dijkstra's search algo-
rithm. The only difference is in the calculation of the costs of the nodes on
the search frontier. The adjusted cost, F, to the node when positioned on the
priority queue (the search frontier), is calculated as:
F=G+H
(5.3)
where G is the cumulative cost to reach a node and H is the heuristic esti-
mate of the distance to the target. For an edge E that has just come off the
frontier and been added to the SPT, the pseudocode to calculate the cost to
its destination node looks like this:
Cost AccumulativeCostTo(E.From) + E.Cost + CostTo(Target)
Utilizing a heuristic in this way, the modified costs direct the search toward
Transcribed Image Text:Graph Search Algorithms diagonal edges cost more to traverse than horizontal or vertical ones. With this in mind you can see how the algorithm has searched a similar distance in every direction before reaching the target. Screenshot 5.7 shows Dijkstra's algorithm operating on the more com- plex map. H² Time Espod for Dia's Search is 0.000274 Screenshot 5.7 The Secret Life of Graphs | 241 H210 1220 Like the BFS, Dijkstra's algorithm examines an awful lot of edges. Wouldn't it be great if the algorithm could be given hints as it progresses to nudge the search along in the correct direction? Well, luckily for us, this is possible. Ladies and gentlemen, please put your hands together in a round of applause and welcome A*! 242 Chapter 5 Dijkstra with a Twist: A* Dijkstra's algorithm searches by minimizing the cost of the path so far. It can be improved significantly by taking into account, when putting nodes on the frontier, an estimate of the cost to the target from each node under consideration. This estimate is usually referred to as a heuristic, and the name given to the algorithm that uses this method of heuristically directed search is A* (pronounced ay-star). And jolly good it is too! If the heuristic used by the algorithm gives the lower bound on the actual cost (underestimates the cost) from any node to the target, then A* is guaranteed to give optimal paths. For graphs that contain spatial informa- tion, such as navigation graphs, there are several heuristic functions you can use, the most straightforward being the straight-line distance between the nodes in question. This is sometimes referred to as the Euclidean distance. TLFEBOOK Graph Search Algorithms A* proceeds in an almost identical fashion to Dijkstra's search algo- rithm. The only difference is in the calculation of the costs of the nodes on the search frontier. The adjusted cost, F, to the node when positioned on the priority queue (the search frontier), is calculated as: F=G+H (5.3) where G is the cumulative cost to reach a node and H is the heuristic esti- mate of the distance to the target. For an edge E that has just come off the frontier and been added to the SPT, the pseudocode to calculate the cost to its destination node looks like this: Cost AccumulativeCostTo(E.From) + E.Cost + CostTo(Target) Utilizing a heuristic in this way, the modified costs direct the search toward
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Single source shortest path
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education