Opening your learning space
Starting the app …
Opening your learning space
Starting the app …
A* ranks open nodes by known path cost g plus estimated remaining cost h to find a least-cost goal path.
Free to browse · flashcards or a multiple-choice quiz · import from Essential
Formula
g, h and f use the same additive path-cost unit; n is a graph node
| Symbol | Meaning | Unit |
|---|---|---|
| Known cost from start to n | path cost | |
| Heuristic estimate of remaining cost | path cost | |
| Priority value used to select the next node | path cost |
f(n)=g(n)+h(n)Optimality requires an admissible heuristic that never overestimates and h(goal)=0. Graph search without reopening closed nodes also requires consistency. Edge costs must be nonnegative and better paths handled correctly. With h=0, A* reduces to Dijkstra. A weak admissible heuristic remains correct but may save little search.
Optimality requires an admissible heuristic that never overestimates and h(goal)=0. Graph search without reopening closed nodes also requires consistency. Edge costs must be nonnegative and better paths handled correctly. With h=0, A* reduces to Dijkstra. A weak admissible heuristic remains correct but may save little search.
A* ranks open nodes by known path cost g plus estimated remaining cost h to find a least-cost goal path.
Heuristic from f and g
For optimality h must not overestimate the remaining path cost.
Use the example for A* search to explain which inputs determine the requested output.
The example connects concrete inputs to its result.
A* ranks open nodes by known path cost g plus estimated remaining cost h to find a least-cost goal path.
The relation applies only under its stated assumptions.
Applying the relation to a different case without checking its stated assumptions.
Check the validity range before substituting values: Optimality requires an admissible heuristic that never overestimates and h(goal)=0. Graph search without reopening closed nodes also requires consistency. Edge costs must be nonnegative and better paths handled correctly. With.
Formula cluster
A* ranks open nodes by known path cost g plus estimated remaining cost h to find a least-cost goal path.
On a unit-cost grid, start=(0,0), goal=(3,2), n=(1,1): g(n)=2 and Manhattan h(n)=|3−1|+|2−1|=3, so f(n)=5. Each move costs at least one, so h does not overestimate.
Find least-cost paths in state spaces and maps with admissible heuristics.
Here is how to work through a typical A* search (f = bisherige Kosten + Heuristik) task step by step:
Task
Use the example for A* search to explain which inputs determine the requested output.
Solution path
The example connects concrete inputs to its result.
A* ranks open nodes by known path cost g plus estimated remaining cost h to find a least-cost goal path.
The relation applies only under its stated assumptions.
g(n) is the cost already paid from the start to n. h(n) estimates the remaining cost to the goal. A* adds them and selects a node with small f(n). The priority combines an exact prefix with an estimate. Keep both terms in the same cost units; adding metres to seconds is meaningless. A* depends on both its path-cost model and heuristic. State whether costs represent distance, time or another nonnegative quantity, and check the heuristic against that same objective. This matters because the estimate must measure the same objective as the cost already paid. This distinction also determines how edge and node costs must be accumulated in the implementation.
A heuristic is admissible when it never exceeds the true cheapest remaining cost from a node. At the goal it should be zero. On a four-direction unit grid, Manhattan distance is admissible because each coordinate offset needs at least one move. Diagonal shortcuts or discounted edges can invalidate the argument, so derive the estimate from actual move rules. A* depends on both its path-cost model and heuristic. State whether costs represent distance, time or another nonnegative quantity, and check the heuristic against that same objective. For each allowed move, verify that the lower-bound derivation still holds. For small graphs, compare each heuristic value with an exact shortest remaining route.
Consistency requires h(u)≤c(u,v)+h(v) for every edge u→v. It is triangle-like: the estimate from u cannot exceed the edge cost plus the neighbor estimate. Then f-values do not decrease along a path, so standard graph-search A* need not reopen closed nodes. Admissibility alone can still work if the implementation reopens nodes correctly. A* depends on both its path-cost model and heuristic. State whether costs represent distance, time or another nonnegative quantity, and check the heuristic against that same objective. A consistent heuristic avoids unnecessary reopening and simplifies the correctness proof. Reopening is an implementation choice tied to the heuristic property, not a change to the path-cost definition.
Then f(n)=g(n), so A* expands the frontier node with the smallest known start cost. With nonnegative edge weights this is Dijkstra’s algorithm. It remains optimal but has no directional guidance and may explore many nodes that a stronger valid heuristic would postpone. The zero heuristic is a useful correctness baseline and benchmark for heuristic efficiency. A* depends on both its path-cost model and heuristic. State whether costs represent distance, time or another nonnegative quantity, and check the heuristic against that same objective. Compare expanded-node counts for equally optimal solutions, not only the runtime of a single case. This gives a fair comparison with Dijkstra while preserving optimal path cost as the correctness criterion.
From (0,0) to (3,2), Manhattan distance is five moves. At n=(1,1), two moves have been taken, so g=2; three coordinate steps remain, so h=3 and f=5. In this obstacle-free grid the estimate equals the shortest remaining path. Obstacles may make the route longer, but cannot beat the Manhattan lower bound. A* depends on both its path-cost model and heuristic. State whether costs represent distance, time or another nonnegative quantity, and check the heuristic against that same objective. This check assumes unit costs; weighted steps require g and h to account for their weights. This example counts moves; weighted paths must instead sum the actual edge costs.
Quanta exam set
Curated exam set for "A* search":
Question (front)
Which formula describes A* search?
Answer in your set
Question (front)
How do you rearrange A* search for Heuristic from f and g?
Answer in your set
Question (front)
Which common mistake happens with A* search?
Answer in your set
+ 7 more cards: units, variables, derivation, example, exam task
The formula set contains 10 cards. After importing, review them and start practicing; your ratings determine later review intervals.
This list names subject references and further reading. A page or section number appears when it is part of the reference; these are not verbatim quotations.
Create a curated FSRS exam set for f = bisherige Kosten + Heuristik: formula recall, variables, derivation, rearrangement, worked example, common mistakes and exam context.
Curated formula set · LaTeX · FSRS spaced repetition · import from Essential