Graphs from scratch: adjacency lists, BFS and DFS

11 steps · about 3 h 35 min · Beginner

  1. Graph Theory Introduction (video, William Fiset (YouTube), 15 min)

    It introduces vertices, edges, directed and weighted graphs, and the common ways to store them, so the later steps have a vocabulary.

  2. Adjacency list (reference, Wikipedia, 10 min)

    It defines the adjacency list precisely and explains why it suits sparse graphs better than a matrix.

  3. Graph Data Structures (Adjacency Matrix, Adjacency List, Edge List) (interactive, VisuAlgo, 20 min)

    You can draw your own graph and watch the matrix, list and edge list change side by side.

  4. Graph Data Structure: Types, Representation, BFS, DFS (article, Masai School, 20 min)

    A short Python walkthrough that builds a matrix and a list from the same edge list, then runs a first traversal.

  5. Graph Traversal (Depth/Breadth First Search) - VisuAlgo (interactive, VisuAlgo, 25 min)

    Step through BFS and DFS on the same graph to see the difference between level-by-level and go-deep-then-backtrack.

  6. Graph Traversal in Python: BFS vs DFS on an Adjacency List (article, datmt.com, 20 min)

    Short, runnable Python for a queue-based BFS and a recursive DFS, including a disconnected component to handle.

  7. Breadth-first search (reference, Wikipedia, 15 min)

    It covers the formal view: the queue-to-stack link with DFS, the BFS tree, and memory trade-offs.

  8. BFS & DFS Time Complexity: O(V+E) vs O(V²) (article, singhajit.com, 15 min)

    It explains why traversal costs O(V+E) with a list and O(V²) with a matrix, and gives a BFS shortest-path template.

  9. Graphs in C#: Adjacency List, BFS, DFS, and Real-World Applications (article, Cipher Thoughts, 20 min)

    It repeats the same pattern in C#, including iterative DFS with an explicit stack, which helps you see the idea apart from the language.

  10. LeetCode 200 Number of Islands Solution & Explanation (tutorial, NeetCode, 30 min)

    It applies BFS to a grid treated as an implicit graph, a classic first practice problem.

  11. Number of Islands | Leetcode 200 | Explained using BFS and DFS (article, Code and Debug, 25 min)

    It solves the same problem with both BFS and DFS, so you can compare them directly.