Search⌘ K
AI Features

Breadth-first search and its uses

Explore breadth-first search to understand how it finds shortest paths in graphs by exploring vertices layer by layer. Learn to implement BFS to solve problems such as pathfinding in mazes and the 'six degrees of Kevin Bacon' game, gaining insight into graph traversal and shortest path algorithms.

We'll cover the following...

In the introductory tutorial, you played with having a character move through a maze to reach a goal. You started by saying that the goal is zero steps away from itself. Then you found all the squares that were one step away from the goal. Then all squares two steps away from the goal. Then three steps, and so on, until you reached the square where the character started. If you kept track of which square at distance kk ...