I've been asked to investigate improvements to Dijkstra's algorithm. I have been researching the A Star algorithm but I find many explanations use unfamiliar words and mathematical notations.
I understand A Star considers only edges towards the target node. For example if the A Star algorithm was being applied to the road network of the UK, and the destination was Dundee and I began at London, only edges leading north would be examined.
Is this at least kind of correct?
A* algorithm A* assigns a weight to each open node equal to the weight of the edge to that node plus the approximate distance between that node and the finish. This approximate distance is found by the heuristic, and represents a minimum possible distance between that node and the end.
I'm quite sure the * (star) in the A* algorithm means that the algorithm is admissible, i.e. it is guaranteed that it finds the shortest path in the graph if this path exists (when the heuristic employed is optimistic).
A * algorithm is a searching algorithm that searches for the shortest path between the initial and the final state. It is used in various applications, such as maps. In maps the A* algorithm is used to calculate the shortest distance between the source (initial state) and the destination (final state).
A* is an informed search algorithm, or a best-first search, meaning that it is formulated in terms of weighted graphs: starting from a specific starting node of a graph, it aims to find a path to the given goal node having the smallest cost (least distance travelled, shortest time, etc.).
A* uses a heuristic to guess the minimal cost of a node to the target. So when choosing a node, you don't only analyze the cost from the start to this node but also the probable cost from the node to the target. This allows to ignore paths that probably lead in the wrong direction.
If the heuristic in your example uses the geographic distance of the nodes, then roads leading north will be examined first (because they have a small estimated overall cost). But it is possible that during the execution of the algorithm those roads aggregate a very large actual distance from the start (maybe because there are lots of curves). Then also roads leading south can be examined. So it is possible to go south for a bit and go straight north if this is shorter than all the curvy roads leading north (not taking into account the actual road map of GB).
The nature of the heuristic defines the quality of the algorithm. If the heuristic gives a lower bound for the distance (i.e. it is not possible to get to the target with a cheaper cost than the heuristic says), then the path is really the shortest path. If the heuristic is not a lower bound, other paths could be allowed as well (which might be a tradeoff between algorithm runtime and path quality). The better the heuristic estimates the minimal cost, the less wrong directions you will examine. I.e. if the heuristic is constant, you'll end up with a plain Dijkstra's algorithm. If the heuristic calculates the actual cost to the target, you will only follow the shortest path and no other nodes will be examined.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With