CS252 Algorithms Friday, 24 May 2024 + Today is Honors Convo day - class 9:30-10:20 - office hours 10:30-11:20 (3A) - honors convo 3:00-4:00 + Questions + Playing with another flow network - See the slides ====== We didn't do this today ====== ====== (this is an outline of the key ideas in 7.2) ====== + Network flows Assume - G = (V,E) - s in V, no in-coming edges - t in V, no out-going edges - integer capacity c_e > 0 for every e in E Definitions - f : E -> R - f^out(v) = sum_{(v,u) in E} f(v,u) <-- v is a node - f^in(v) = sum_{(u,v) in E} f(u,v) <-- v is a node - f is a "flow" if - for any e in E, 0 <= f(e) <= c_e - for any v in V != s or t, f_in(v) = f_out(v) - v(f) = "value" of the flow = sum_{(s,u) in E} f(s,u) - G_f is the residual graph (not gonna define it here) - (A,B) is an "s-t cut" of G if - s in A - t in B - B = V - A - c(A,B) = sum_{(u,v) in E, u in A, v in B} f(u,v) <-- A is a set of nodes - f^out(A) = sum_{(u,v) in E, u in A, v in B} f(u,v) <-- A is a set of nodes - f^in(A) = sum_{(u,v) in E, u in B, v in A} f(u,v) <-- A is a set of nodes - c(A,B) = sum_{(u,v) in E, u in A, v in B} Theorems (throughout, f is any flow, (A,B) is any s-t cut) - v(f) = f^out(A) - f^in(A) - v(f) <= c(A,B) - If v(f) = c(A,B), then f is a maximum flow - If G_f has no s-t paths, then f is a maximum flow (and A = {v in V | an s-v path exists in G_f} gives you a cut for which v(f) = c(A,B)) That last one says "Ford-Fulkerson gives you a maximum flow Max flow = min cut