Inferensys

Glossary

A* Search Algorithm

The A* search algorithm is an informed graph traversal and pathfinding method that efficiently finds the least-cost path from a start node to a goal node by combining the actual cost from the start with a heuristic estimate of the remaining cost to the goal.
Stylish WeWork-like workspace with hot desks and document wall, professional searching through enterprise knowledge base on a mounted ultrawide display, warm industrial pendants overhead.
MOTION PLANNING AND TRAJECTORY OPTIMIZATION

What is the A* Search Algorithm?

A* (pronounced "A-star") is a foundational graph traversal and pathfinding algorithm that efficiently finds the least-cost path from a start node to a goal node by combining actual traveled cost with a heuristic estimate of the remaining cost.

The A search algorithm* is a best-first, informed search algorithm that guarantees finding an optimal path if an admissible and consistent heuristic is used. It operates by maintaining a priority queue of nodes to explore, prioritized by the sum f(n) = g(n) + h(n), where g(n) is the exact cost from the start node to node n, and h(n) is the heuristic estimate from n to the goal. This combination allows A* to systematically explore the most promising paths first, unlike uninformed algorithms like Dijkstra's Algorithm which explores uniformly.

In robotics and motion planning, A* is often applied to discretized representations like grids or lattices to compute collision-free paths. Its efficiency and optimality make it a cornerstone for global planning, frequently used in conjunction with local planners like the Dynamic Window Approach (DWA). Variants like Weighted A* trade optimality for speed by inflating the heuristic, while implementations in libraries like the Open Motion Planning Library (OMPL) handle continuous configuration spaces (C-Space) through state sampling and collision checking.

ALGORITHM MECHANICS

Key Properties and Characteristics of A*

A* is distinguished from other graph search algorithms by its specific formulation and guarantees. These core properties define its optimality, efficiency, and practical application in robotics and motion planning.

01

Admissible Heuristic

An admissible heuristic is a condition where the estimated cost from any node n to the goal is never greater than the true cost. Formally, h(n) ≤ h*(n) for all n, where h*(n) is the true optimal cost-to-go. This property is the absolute requirement for A* to guarantee an optimal path. If a heuristic overestimates the cost, A* may find a suboptimal solution. In robotics, the Euclidean distance to the goal is a classic admissible heuristic for a robot moving in free space.

02

Consistency (Monotonicity)

A consistent (or monotone) heuristic satisfies the triangle inequality: h(n) ≤ c(n, n') + h(n') for every successor node n' of n, where c(n, n') is the step cost. Consistency is a stronger condition than admissibility. It guarantees that:

  • The f(n) cost (total estimated cost) is non-decreasing along any path.
  • The first time A* expands a node, it has found the optimal path to it.
  • The algorithm does not need to re-open nodes from the closed set, simplifying implementation. Most well-designed heuristics in robotics, like Euclidean distance, are consistent.
03

Optimality Guarantee

Given an admissible heuristic, A* is guaranteed to find the globally optimal path from the start to the goal, provided a path exists. This is its most critical property for motion planning, where fuel, time, or wear must be minimized. The proof relies on the fact that A* expands nodes in order of their f(n) score. Since f(n) for the goal node is its true cost when using an admissible heuristic, any path with a higher cost will have a higher f score and be expanded later (or not at all).

04

Completeness

A* is complete on finite graphs with non-negative edge costs. This means it will always find a solution if one exists and will correctly terminate with failure if no path exists. Completeness is essential for reliable robotic systems; the planner must not silently fail. In infinite or continuous state spaces (like robot configuration space), basic A* is not directly applicable. However, when paired with a suitable discretization (e.g., a grid) or a sampling-based graph construction method, the overall planning approach retains this completeness property.

05

Cost Function: f(n) = g(n) + h(n)

A*'s decision-making is governed by the evaluation function f(n) = g(n) + h(n).

  • g(n) is the actual cost from the start node to node n. It represents the known, incurred cost.
  • h(n) is the heuristic estimate of the cost from n to the goal. It represents the informed "guess" about the remaining cost.
  • f(n) is the estimated total cost of the cheapest solution through n. The Open Set (frontier) is always ordered by f(n). This elegant combination of known past cost and estimated future cost is what balances thoroughness and directed search speed.
06

Trade-off: Heuristic Strength vs. Search Efficiency

The accuracy of the heuristic h(n) directly controls A*'s performance. The closer h(n) is to the true cost h*(n) (without overestimating), the fewer nodes A* will expand. At the extremes:

  • If h(n) = 0 for all n, A* degenerates into Dijkstra's Algorithm, which is optimal but expands nodes in all directions equally (slow).
  • If h(n) = h*(n) (perfect heuristic), A* expands only the nodes on the optimal path, achieving ideal efficiency.
  • In practice, a well-designed heuristic like straight-line distance provides a strong, admissible guide, making A* vastly more efficient than Dijkstra's for geometric pathfinding.
FEATURE COMPARISON

A* vs. Other Pathfinding Algorithms

A comparative analysis of A* against other fundamental pathfinding and graph search algorithms, highlighting their core mechanisms, guarantees, and typical use cases in robotics and motion planning.

Feature / MetricA* Search AlgorithmDijkstra's AlgorithmGreedy Best-First SearchRapidly-exploring Random Tree (RRT)

Algorithm Type

Informed graph search

Uninformed graph search

Heuristic-driven graph search

Sampling-based planner

Optimality Guarantee

Completeness Guarantee

Core Search Driver

f(n) = g(n) + h(n) (cost + heuristic)

g(n) (accumulated cost)

h(n) (heuristic to goal)

Random sampling & nearest-neighbor connection

Heuristic Requirement

Admissible heuristic required for optimality

Not required

Required, but not for optimality

Not required

Primary Use Case

Optimal pathfinding in known graphs (grids, road networks)

Single-source shortest paths in weighted graphs

Fast, satisficing paths where optimality is secondary

High-dimensional, non-convex spaces (robot arm C-space)

Computational Complexity (Worst-case)

O(b^d), where b is branching factor, d is depth

O(|E| + |V| log |V|) with priority queue

O(b^m), where m is max depth

No explicit complexity; probabilistic completeness

Typical Data Structure

Priority queue (min-heap) on f(n)

Priority queue (min-heap) on g(n)

Priority queue (min-heap) on h(n)

Tree (graph) in C-space

A* SEARCH ALGORITHM

Frequently Asked Questions

A* (pronounced 'A-star') is a foundational graph traversal and path search algorithm central to motion planning in robotics and AI. It is renowned for its efficiency and optimality guarantees, making it a cornerstone for navigation in both virtual and physical spaces.

The A search algorithm* is an informed graph traversal and pathfinding algorithm that finds the least-cost path from a start node to a goal node. It works by maintaining a priority queue of nodes to explore, ordered by a total cost function f(n) = g(n) + h(n), where g(n) is the actual cost from the start node to node n, and h(n) is a heuristic function estimating the cost from n to the goal. At each step, A* expands the node with the lowest f(n). It is both complete (will find a solution if one exists) and optimal (will find the lowest-cost path) provided the heuristic is admissible (never overestimates the true cost).

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.