the A* algorithm does: BFS with heuristic f(n) = g(n) + h(n)

How do GPS systems find the best route when driving?

Image: NASA/Bill Stafford, James Blair, Regan Geeseman, Public domain, via Wikimedia Commons

the A* algorithm does: BFS with heuristic f(n) = g(n) + h(n)

How do GPS systems find the best route when driving?

Imagine you're stuck in traffic and need to get to work quickly. You want the fastest route, avoiding the congested roads.

Think of A* as a smart GPS that not only looks at the distance you've traveled (g(n)) but also estimates the distance to your destination (h(n)), combining them to find the quickest path.

Example

You drive 10 miles (g(n)) and there's a shortcut that saves 5 miles (h(n)), A* would choose it, saving you 5 miles in total.

Remember this

A* uses g(n) + h(n) to efficiently find the best route.

Related concepts

Swipe through 100 ML concepts daily

Open Pocket Polymath