Breadth First Search VS. Depth First Search (with Pictures!)
An illustrated introduction to BFS and DFS through an undirected graph (no prior knowledge necessary).
Published in
3 min readFeb 2, 2022
Breadth First Search and Depth First Search are basic search algorithms that represent a simple method to solve a problem. They are a precursor to modern types of search and in my opinion a must know building block for learning artificial intelligence.
If learning artificial intelligence is your overall goal I recommend checking out this great post by Daniel Bourke:
Background
Undirected vs Directed Graph
To be completely honest I was confused when I first heard the terms “undirected graph” and “directed graph”. Before we get into the meat of this article let me clarify: