Skip to content
All tags

#graph-algorithms

3 posts

Graph Representations, DFS, BFS, and Proofs About Search Order | Stanford CS161 Lecture 9

DFS and BFS both scan an adjacency-list graph in O(n+m); DFS finish times produce a topological order for a DAG, while BFS layers equal exact unweighted shortest-path distances.

Why Two DFS Passes Find Strongly Connected Components | Stanford CS161 Lecture 10

Contracting each SCC always produces a DAG; first-pass DFS finish times order those components, and a second pass on the transposed orientation discovers exactly one SCC per DFS tree in O(n+m).

Dijkstra, Bellman-Ford, and Two Orders of Relaxation | Stanford CS161 Lecture 11

Dijkstra finalizes the minimum estimate and relies on nonnegative weights; Bellman-Ford repeatedly relaxes every edge, spending O(nm) to support negative edges and detect a negative cycle reachable from the source.