Meaning and conditions
Step-by-step reasoning
Consistency makes reduced weights w′(u,v)=w(u,v)+h(v)−h(u) nonnegative. Along a path, heuristic terms telescope: total reduced cost equals original cost plus h(goal)−h(start). Every source-to-goal route receives the same addition. Their optimal order is preserved, and A* priority corresponds, up to a fixed source constant, to Dijkstra distance in the reduced graph.[2]
Local consistency condition of this model.[2]
The search equation does not learn a heuristic. Correctly relaxing a problem can supply an exact relaxed solution that lower-bounds the original problem.[1]
The heuristic changes frontier order
Why a is selected before b
Free with a Quanta account. Your download stays ready after registration.
Two fully worked original examples
A consistent heuristic directs search toward the goal
- Given
- sa=2,sb=2,ab=10,at=2,bt=7; hs=4,ha=2,hb=7,ht=0.
- Find
- Check consistency and run A* until the goal is removed.
All five edges satisfy h(u)≤w(u,v)+h(v).
After s, estimated remaining cost separates two equally cheap prefixes.
a supplies goal candidate 4; t is removed next.
Result: A* returns s→a→t of cost 4; s,a,t are removed.
Check: Other routes cost 9 and 19. With the same tie rule, Dijkstra would process b at distance 2 before t; this example saves one vertex, not a universal runtime guarantee.
h=0 connects A* to Dijkstra
- Given
- sa=2,sb=5,ab=1,at=6,bt=2; all h values 0.
- Find
- Calculate priorities and the shortest path.
The heuristic provides no goal direction but violates no consistency edge.
Choose the smallest prefix cost and improve candidates.
Next b improves the target to 5.
Result: Removal order s,a,b,t gives cost 5 via s→a→b→t.
Check: Alternatives cost 8 and 7. On this graph the zero heuristic exactly matches Dijkstra’s priority.
Recall the method later with the formula’s flashcards.
10 flashcards · English materials
Already have an account? Sign in for flashcardsAvailable from Essential. A ready-made formula set, no AI credits required. Article exercises are not all included.
Five exercises with solutions
Calculate · Foundation
An open vertex has g=7 and h=4. Find f. Another has g=9,h=1. Which is selected first?
Show hint
A* adds both cost terms.
Learning goal: Prioritize known and estimated costs together.
Rearrange · Foundation
At one vertex f=12,g=5. What h value is used? Does this prove the value admissible?
Show hint
Solve f=g+h for h.
Learning goal: Distinguish rearrangement from a model assumption.
Interpret · Application
Check edge b→t of weight 7 with hb=7,ht=0 in the first graph. What does equality mean?
Show hint
Use the local consistency inequality.
Learning goal: Interpret a local consistency check.
Error analysis · Application
On the second graph set hs=0,ha=10,hb=0,ht=0. Graph search without reopening chooses b then t with cost 7. May it claim optimality?
Show hint
Check h(a) on edge a→t and compare the existing route through a,b.
Learning goal: Locate a violated optimality assumption in a numeric example.
Transfer · Application
A four-neighbor grid allows only horizontal and vertical steps of cost 1. Why is Manhattan distance useful when some cells are blocked?
Show hint
Temporarily remove obstacles.
Learning goal: Derive a heuristic from an explicitly relaxed problem.
Show solution and calculation
Without obstacles at least |Δx|+|Δy| steps are needed and this is achievable.
Obstacles cannot shorten the permitted route.
One allowed step changes Manhattan distance by at most 1, also establishing local consistency.
Diagonal moves or different costs require a new check.
Check your understanding with the formula’s reference test.
8 test questions · English materials
Already have an account? Sign in for the testAvailable from Essential. A ready-made formula set, no AI credits required. Article exercises are not all included.
Model limits and next steps
An admissible but inconsistent heuristic can require reopening depending on the graph-search variant. This calculator does not implement that different contract. Fewer processed vertices in one example do not guarantee a general speed advantage.[1][2]
Dijkstra explains selection by known costs. BFS and DFS supply search foundations; Big O separates computational effort from measured runtime.
Sources for this explanation
Quanta · Updated November 9, 2026
- UC Berkeley CS188: 1.4 Informed Search — §1.4.1 Heuristics; §1.4.3 A*; §1.4.4 Admissibility
- Stanford CS221 States-based Models — A* search; Consistency, correctness; Relaxation
Editorial responsibility: Quanta Study editorial team
Review scope
This explanation, 2 worked examples and 5 exercises are available in German and English. Structure, source references and mathematical notation undergo automated checks. Calculations, model assumptions and both language versions receive a separate AI review.
An independent, named human subject review has not yet been documented. Our exercise numbers are worked examples, rather than measurements published by the cited sources.
Editorial responsibility, sources and methodsChange history
- Created a DE/EN author draft with a bounded model, original graphic, two examples and varied solved exercises.
Cite this reference page
Quanta. A* search. Updated November 9, 2026. https://quanta-study.de/en/formula-sheet/a-star-suche
When citing a specific scientific statement, also cite the specialist source linked to that statement.