Graph algorithms: BFS, DFS, Dijkstra and A*, step by step

12 steps · about 4 h 32 min · Intermediate

  1. Depth First Search Algorithm | Graph Theory (video, WilliamFiset (YouTube), 15 min)

    DFS is the simplest traversal and introduces graphs, visited sets and stacks or recursion.

  2. Breadth First Search Algorithm | Shortest Path | Graph Theory (video, WilliamFiset (YouTube), 15 min)

    BFS swaps the stack for a queue, and that change gives shortest paths on unweighted graphs.

  3. Breadth-first search (article, Wikipedia, 15 min)

    It compares BFS and DFS on completeness and memory use, so you can see the trade-offs.

  4. Lecture 17: BFS, DFS, Dijkstra, CSE 373: Data Structures and Algorithms (doc, University of Washington, 30 min)

    A university lecture that puts BFS, DFS and Dijkstra side by side, and shows how Dijkstra grows a cloud of settled vertices.

  5. Dijkstra's Algorithm - Computerphile (video, Computerphile (YouTube), 10 min)

    A short, clear walkthrough of weighted shortest paths using the sat-nav example.

  6. Graph Algorithms in Python: BFS, DFS, and Beyond (tutorial, freeCodeCamp, 30 min)

    Working Python for all four algorithms, so you can type them in and run them.

  7. Tracing the Path in DFS, BFS, and Dijkstra's Algorithm (article, Baeldung, 20 min)

    Finding a distance is not enough, so this shows how to recover the actual path with parent pointers.

  8. Introduction to the A* Algorithm (interactive, Red Blob Games (Amit Patel), 40 min)

    Interactive diagrams take you from BFS to Dijkstra to A*, so you can see why the heuristic helps.

  9. A* Pathfinding (E01: algorithm explanation) (video, Sebastian Lague (YouTube), 12 min)

    Explains the G, H and F costs and the open and closed sets, which you need before coding A*.

  10. Pathfinding Algorithm Visualizer (interactive, LivePhysics, 15 min)

    Draw walls and weights, then run all four algorithms on the same grid and compare how much each explores.

  11. Amit's A* Pages (guide, Red Blob Games (Amit Patel), 30 min)

    Covers heuristic choice (Manhattan, diagonal, Euclidean) and the speed versus accuracy trade-off.

  12. mallicee/pathfinder: Interactive pathfinding & maze visualizer (repo, GitHub, 40 min)

    A small dependency-free JS codebase where you can read how Dijkstra, A* and BFS share a heap-based core.