##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
Explore individual topics with detailed lessons and practice problems.
Terminology, representations (adjacency list/matrix/edge list), graph properties, and complexity analysis.
Recursive and iterative DFS, discovery/finish times, DFS tree, and back edges.
Level-order traversal, unweighted shortest path, multi-source BFS, and BFS applications.
Implicit graphs, 4/8-connectivity, island counting, and boundary fill problems.
You know BFS and can traverse graphs. Some graphs split into two groups with no same-group edges.
Tree properties (N-1 edges, unique paths), rooting trees, parent/child relationships, and tree traversals.
Finding tree diameter with two-BFS and DP methods, computing tree center and radius, and solving all-nodes distance queries with rerooting DP.
Processing trees from leaves to root. Aggregating subtree values. Include/exclude patterns and path optimization.
All-pairs shortest paths. Dynamic programming on graphs. Finding distances between every pair of nodes.
Priority queue implementation, lazy deletion, proof of correctness, and optimizations.
Dijkstra breaks with negative edges. Bellman-Ford handles them and detects negative cycles. You'll learn when to use each algorithm.
You've learned BFS, Dijkstra, Bellman-Ford, and Floyd-Warshall. Now practice mixing them together.
Union by rank/size, path compression, rollback DSU, and applications.
Spanning trees connect all nodes with minimum edges. Learn Kruskal's and Prim's algorithms.
Kahn's algorithm (BFS-based), DFS-based topological sort, and cycle detection in directed graphs.
Shortest/longest path in DAGs, counting paths, and DP with topological order.
You've learned BFS, DFS, cycle detection, and DP on DAGs. Now you choose which technique to use for each problem.
Mutual reachability in directed graphs. Kosaraju and Tarjan algorithms. The condensation DAG.
Converting logic constraints into implication graphs. Using SCCs to determine satisfiability and construct valid assignments.
Mixed Practice: Connectivity & MST
You know tree DP for one root. Learn to compute answers for all roots in linear time.
Flatten trees into arrays. Subtrees become ranges. Query and update subtrees with range structures.
Pattern recognition practice. Decision trees for choosing the right technique. Six problems spanning all tree fundamentals.
Find ancestors by jumping one step at a time? That's O(n). Binary lifting makes it O(log n).
You've learned binary lifting. Now find the lowest common ancestor of two nodes efficiently.
Two-player games where positions are graph nodes. You analyze winning strategies using backward induction.
You know Euler tours for subtrees. HLD handles path queries by decomposing into heavy chains.
Some distance problems resist DFS and DP. Centroid decomposition gives divide-and-conquer on trees.
You know how to process subtrees. Now merge results from children using small-to-large merging.
What if every node has exactly one outgoing edge? These functional graphs have special structure.
Mixed Practice: Advanced Tree Techniques
(Critical edges and vertices)
A whole class you haven't touched: flow networks. Learn Ford-Fulkerson and maximum flow.
Two groups where members can connect across groups. Find the maximum number of matched pairs.
You've mastered max flow. Now learn minimum cuts: the cheapest way to disconnect source from sink.
Visit every edge exactly once. Learn when Eulerian paths exist and how to find them.
Test your ability to recognize which graph algorithm to apply. Problems spanning flow, matching, SCCs, and more.