Py
Py
Run
What do you want to learn?
Lessons
⌄
Browse the curriculum
Find your level
Practice problems
Interview prep
Cheat sheets
Career paths
Explore by role
All lessons
Fundamentals
Web development
Data
Engineering
Data science
Machine learning
GenAI & RAG
Automation
DSA / interview
Tools
new
⌄
Online compiler
Playground
Revise
Terminal
SQL playground
Notebook
Build
⌄
Workspaces
Guided projects
My published sites
Blog
Pricing
AI
en
Sign in
Start free
→
Start free
→
loading…
Feedback
💬
Ask PyRun
Home
›
All lessons
›
DSA
›
Graph BFS — shortest paths on unweighted graphs
Graph BFS — shortest paths on unweighted graphs
Advanced
12 min
DSA
dsa · graphs · bfs · interview
Try it
↓
Lesson
14
of
30
In this track
▾
1
Big-O notation — measuring how code scales
12 min
2
Arrays: the workhorse of DSA
10 min
3
Two Pointers — the interview technique that wins interviews
10 min
4
Sliding Window — the pattern for subarray problems
12 min
5
Hashing — the O(1) lookup that unlocks interviews
10 min
6
Binary Search — O(log n) on sorted data
12 min
7
Stacks — LIFO and the problems it solves
10 min
8
Queues, Deques, and BFS foundations
10 min
9
Recursion — thinking in terms of subproblems
12 min
10
Sorting — merge, quick, and when Python's sorted() isn't enough
12 min
11
Binary Trees — traversals and recursion
12 min
12
Binary Search Trees — ordered lookup in O(log n)
13 min
13
Graph Representations — adjacency list, matrix, edge list
11 min
14
Graph BFS — shortest paths on unweighted graphs
12 min
15
Graph DFS — cycles, components, and back-edges
13 min
16
Topological Sort — ordering DAGs
12 min
17
Dynamic Programming — remembering to not re-compute
12 min
18
House Robber — choice DP in one dimension
12 min
19
Coin Change — unbounded knapsack, minimum coins
13 min
20
Longest Increasing Subsequence — O(n²) DP and the patience trick
14 min
21
Edit Distance — 2D DP on a grid
15 min
22
Heaps + Priority Queues — the O(log n) sorted-ish structure
12 min
23
Tries — the prefix tree behind autocomplete
13 min
24
Union-Find — the near-O(1) connectivity structure
13 min
25
LRU Cache — build the one behind functools.lru_cache
14 min
26
Top-K Problems — heap, sort, or quickselect?
12 min
27
Backtracking — try, recurse, un-try
13 min
28
Greedy — locally optimal, globally lucky
12 min
29
Bit manipulation — arithmetic in binary
11 min
30
String matching — naive, hashed, and 'just use in'
11 min
←
→
Loading lesson…
←
Previous lesson
Graph Representations — adjacency list, matrix, edge list
Advanced · 11 min
Next lesson
→
Graph DFS — cycles, components, and back-edges
Advanced · 13 min
Related lessons
Advanced · 11 min
Graph Representations — adjacency list, matrix, edge list
The three ways to store a graph in memory and how the choice shapes every algorithm you run on it.
Advanced · 13 min
Graph DFS — cycles, components, and back-edges
Depth-first search recursively and iteratively, plus the two classic use cases: connected components and cycle detection.
Advanced · 12 min
Topological Sort — ordering DAGs
Kahn's algorithm and DFS-based toposort — turning a directed acyclic graph into a valid linear schedule.