Thomas Piacentini
← Workshop
← All concepts

Find a path

Concept 1 / 5

Change concept
01 · Map, vertices and edges

Map, vertices and edges

A map becomes a set of positions and allowed moves between them.

Your turn

3
SGh = 3 + 2 = 5f = g + h = 3 + 5 = 8
InputTransformationResult

Add cost already paid8

A* priority is f=g+h. The control changes g, not the five remaining steps.

Build
Final result · Exploration priority8

Understand the calculation, step by step

A graph abstracts the map: vertices are states and edges permitted moves. Obstacles remove passages and weights express costs. A point path does not ensure clearance for a robot with radius. Account for its footprint; the integrated mission also checks disk collisions.

A* priority

cell=(2,1), goal=(5,3) ; Manhattan h=5 ; f=g+h

Check my understanding

For Accumulated cost g = 5, what is the value of « priority f » ?

Keep a thought in my notebook
Read the source and go further

The extended record combines confirmed reading, interaction, correct answer and a note of at least 40 characters. You can continue at any time.

02 · Breadth-first search and stopping

Breadth-first search and stopping

Exploring in widening layers finds a short path when every step costs the same.

Your turn

3
SGh = 3 + 2 = 5f = g + h = 3 + 5 = 8
InputTransformationResult

Add cost already paid8

A* priority is f=g+h. The control changes g, not the five remaining steps.

Build
Final result · Exploration priority8

Understand the calculation, step by step

BFS uses a FIFO queue and visits in increasing edge count. It finds a shortest path when edge costs are equal. Store each vertex parent to reconstruct the path, then stop on reaching the goal according to the algorithm. Explored-cell count differs from final path length.

A* priority

cell=(2,1), goal=(5,3) ; Manhattan h=5 ; f=g+h

Check my understanding

For Accumulated cost g = 5, what is the value of « priority f » ?

Keep a thought in my notebook
Read the source and go further

The extended record combines confirmed reading, interaction, correct answer and a note of at least 40 characters. You can continue at any time.

03 · Costs and relaxation

Costs and relaxation

The cheapest path does not always cross the fewest cells.

Your turn

2
832Suvmin(8 ; 3 + 2) = 5
InputTransformationResult

Dashed: the known route of cost 8.

Keep the best5

Relaxation replaces the old cost only if the new one is lower.

Build
Final result · Best known cost for the next cell5

Understand the calculation, step by step

Dijkstra prioritizes accumulated cost g. Relaxing u→v compares g(v) with g(u)+cost(u,v). With nonnegative costs, removing the goal from the queue settles its optimal cost. A geometrically shorter route can cost more when it crosses slow terrain.

Relax an edge

g(u)=3, g(v)=8 ; g′(v)=min(8,3+edge cost)

Check my understanding

For Edge cost = 4, what is the value of « new cost g(v) » ?

Keep a thought in my notebook
Read the source and go further

The extended record combines confirmed reading, interaction, correct answer and a note of at least 40 characters. You can continue at any time.

04 · Heuristic and greedy search

Heuristic and greedy search

Heading straight for a goal may miss a cheaper detour.

Your turn

3
SGh = 3 + 2 = 5f = g + h = 3 + 5 = 8
InputTransformationResult

Add cost already paid8

A* priority is f=g+h. The control changes g, not the five remaining steps.

Build
Final result · Exploration priority8

Understand the calculation, step by step

A heuristic h estimates remaining cost. Greedy search uses h alone: it may reach the goal quickly while missing a cheaper detour. Manhattan distance suits a grid without diagonals and with a known minimum step cost. Changing permitted moves requires revisiting the heuristic.

A* priority

cell=(2,1), goal=(5,3) ; Manhattan h=5 ; f=g+h

Check my understanding

For Accumulated cost g = 5, what is the value of « priority f » ?

Keep a thought in my notebook
Read the source and go further

The extended record combines confirmed reading, interaction, correct answer and a note of at least 40 characters. You can continue at any time.

05 · A* and optimality

A* and optimality

A* combines cost already paid with a cautious estimate of what remains.

Your turn

3
SGh = 3 + 2 = 5f = g + h = 3 + 5 = 8
InputTransformationResult

Add cost already paid8

A* priority is f=g+h. The control changes g, not the five remaining steps.

Build
Final result · Exploration priority8

Understand the calculation, step by step

A* prioritizes f=g+h. An admissible heuristic never overestimates remaining cost; consistency h(u)≤c(u,v)+h(v) lets vertices be settled without reopening. Otherwise, reopenings must be handled correctly. h=0 recovers Dijkstra. Compare final cost and expansions, then follow the original implementation links.

A* priority

cell=(2,1), goal=(5,3) ; Manhattan h=5 ; f=g+h

Check my understanding

For Accumulated cost g = 5, what is the value of « priority f » ?

Keep a thought in my notebook
Read the source and go further

The extended record combines confirmed reading, interaction, correct answer and a note of at least 40 characters. You can continue at any time.

Take this further

atomsh / lab