Graphs are nodes and edges: cities and roads, people and friendships, tasks and dependencies. Most real data is a graph once you look at it.
Twelve algorithms cover the classic questions: what can I reach, what is the cheapest way, what is the cheapest way to connect everything, and in what order must things happen.
All algorithms
12Each card runs its own algorithmLevel by level from a source.
Deep first, backtrack on dead ends.
Shortest paths with non-negative weights.
Relax every edge V−1 times; handles negative weights.
All pairs shortest paths by dynamic programming.
Grow a minimum spanning tree from one node.
Add cheapest edges that do not form a cycle.
Order tasks so every dependency comes first.
Strongly connected components in one DFS.
Two DFS passes on the graph and its reverse.
Track connected components under unions.
Max flow via shortest augmenting paths.