Notes / tag / graphs

#graphs

10 notes

# Data Structures Algorithms

All Data Structures Algorithms notes →

1 — Graph Representation

Adjacency matrix, adjacency list, and edge list — what a graph adds back once trees drop the acyclic, single-parent, single-root constraints, and why every graph algorithm in this Part needs a visited set that tree traversal never did.

data-structures-algorithms graphs book
Jul 27, 2026

10 — Network Flow

Ford-Fulkerson, the residual graph's backward edges, and Edmonds-Karp's BFS-driven augmenting paths for computing maximum flow through a capacitated graph — plus the max-flow min-cut theorem and why greedy augmentation needs a way to undo itself.

data-structures-algorithms graphs book
Jul 27, 2026

2 — Graph Traversal

DFS and BFS generalized from trees to graphs via one addition — a visited set — plus recursive and iterative DFS, BFS's third appearance of the same queue skeleton, connected components, and multi-source BFS as single-source BFS from an imaginary super-source.

data-structures-algorithms graphs book
Jul 27, 2026

3 — Topological Sorting

Ordering a DAG's nodes so every edge points forward — via DFS post-order or Kahn's BFS-based algorithm.

data-structures-algorithms graphs book
Jul 27, 2026

4 — Shortest Path

Shortest path is four different problems wearing one name: BFS already solves the unweighted case, Dijkstra's min-heap relaxation handles non-negative weights, Bellman-Ford and its negative-cycle check handle any sign, and Floyd-Warshall answers all-pairs — plus an honestly-scoped worked example showing exactly what Dijkstra does and doesn't solve for a k-cheapest-routes problem.

data-structures-algorithms graphs book
Jul 27, 2026

5 — Minimum Spanning Tree

Kruskal's and Prim's algorithms for the minimum-weight edge set connecting every node — why MST is a fundamentally different problem from shortest path, and how the same greedy framing from Part 01 produces two structurally different, equally correct algorithms.

data-structures-algorithms graphs book
Jul 27, 2026

6 — Union Find (Disjoint Set)

Path compression and union by rank turn find and union into O(α(n)) amortized operations — the inverse Ackermann bound stated precisely, dynamic connectivity as edges arrive one at a time, and cycle detection as a direct byproduct of union itself.

data-structures-algorithms graphs book
Jul 27, 2026

7 — Strongly Connected Components

Kosaraju's two-pass DFS algorithm for finding maximal strongly connected components in a directed graph, the finish-time argument for why it works, and Tarjan's single-pass low-link alternative.

data-structures-algorithms graphs book
Jul 27, 2026

8 — Bridges & Articulation Points

Deriving DFS discovery time and low-link values from scratch to find, in one O(V + E) pass, every edge and every vertex whose removal would disconnect an undirected graph.

data-structures-algorithms graphs book
Jul 27, 2026

9 — Eulerian & Hamiltonian Paths

Why an Eulerian path (every edge once) is checkable in O(V) by counting degrees while a Hamiltonian path (every vertex once) is NP-complete with no known shortcut — Hierholzer's algorithm, backtracking search, and why identical phrasing hides opposite tractability.

data-structures-algorithms graphs book
Jul 27, 2026