Graph Theory37 sections · 1633 units
Open in Course

Pattern Summary

(Quick reference guide)

Here is your decision tree:

Shortest unweighted path: BFS (Message Route, Labyrinth)

Multiple sources: Multi-source BFS (Monsters)

Detect cycle: DFS with states for directed, DFS with parent for undirected (Course Schedule, Round Trip)

Longest path / Count paths in DAG: DP on DAG after topo sort (Longest Flight Route)

When you see a new problem, match it to one of these patterns.