--- title: "Consistent heuristic" chunk: 2/2 source: "https://en.wikipedia.org/wiki/Consistent_heuristic" category: "reference" tags: "science, encyclopedia" date_saved: "2026-05-05T09:57:25.369916+00:00" instance: "kb-cron" --- hence f ( P ) ≥ f ( N ) {\displaystyle f(P)\geq f(N)} . In the A* search algorithm, using a consistent heuristic means that once a node is expanded, the cost by which it was reached is the lowest possible, under the same conditions that Dijkstra's algorithm requires in solving the shortest path problem (no negative cost edges). In fact, if the search graph is given cost c ′ ( N , P ) = c ( N , P ) + h ( P ) − h ( N ) {\displaystyle c'(N,P)=c(N,P)+h(P)-h(N)} for a consistent h {\displaystyle h} , then A* is equivalent to best-first search on that graph using Dijkstra's algorithm. With a non-decreasing f ( N ) {\displaystyle f(N)} under consistent heuristics, one can show that A* achieves optimality with cycle-checking, that is, when A* expands a node n {\displaystyle n} , the optimal path to n {\displaystyle n} has already been found. Suppose for the sake of contradiction that when A* expands n {\displaystyle n} , the optimal path has not been found. Then, by the graph separation property, there must exist another node n ′ {\displaystyle n'} on the optimal path to n {\displaystyle n} on the frontier. Since n {\displaystyle n} was selected for expansion instead of n ′ {\displaystyle n'} , this would mean that f ( n ) < f ( n ′ ) {\displaystyle f(n)