CS252 Algorithms Wednesday, 22 May 2024 + Friday is Honors Convo day - class 9:30-10:20 - honors convo 3-4 + Questions? - Homework - Exam - Other + Bellman-Ford question from Monday - Textbook: grow paths backwards from target node t - Alternative (and more like Dijkstra): grow paths forwards from source node s - Understanding how the two M[k,u] recurrences and charts can help you deepen your understanding not just of shortest paths but also dynamic programming and recursion generally + Network flows, continued Network - directed graph G = (V,E); edge capacities c_e >= 0 - source s, no incoming edges - sink t, no outgoing edges A "flow" f on the network - f: E -> R - 0 <= f(e) <= c_e for all e - f_in(v) = f_out(v) for all v != s or t "Value" of a flow - v(f) = sum_{e going out of s} f(e) "Augmenting path" for a flow - path from s to t - "bottleneck" of the path b = min_{e in path} (c_e - f(e)) that is, b is the "minimum available capacity" of all the edges in the path - **IF b > 0**, this path can be used to "augment" v(f) by adding b to all the edges on the path. That's why it's called an augmenting path. Computing maximum-value flow (Ford-Fulkerson algorithm) 1. set f(e) = 0 for all e 2. find an augmenting path with bottleneck b > 0 (if none exists, go to 5) 3. for all edges e in the path, set f(e) = f(e) + b 4. go to 2 5. done How do you do step 2? - Compute the "residual graph" G_f - Use BFS or DFS to find a path from s to t in G_f