tinycodinglm / math /math-0163.jsonl
winapiadmin's picture
Upload folder using huggingface_hub (part 16)
d517dc9 verified
|
Raw History Blame
805 Bytes
opencode trace
System You are an expert mathematician and programmer.

You are an expert mathematician and programmer.

User

Explain max flow algorithms

Assistant

Ford-Fulkerson: augmenting paths in residual graph. O(E*|max_flow|).
Edmonds-Karp: BFS shortest augmenting path. O(VE^2).
Dinic's: blocking flow with BFS level graph + DFS. O(V^2E), O(VE) unit capacities.
Push-relabel: O(V^2*E) worst, often faster. Preflow + push + relabel.
Min-cut = max-flow theorem.
Applications: bipartite matching (source->left, right->sink, cap=1), vertex cover, project selection, image segmentation.