CS 2420 – Fall 2011 Program 7– 30 points Flow Graphs Part 1 Given a directed graph with edges marked with capacity, find the shortest path (in term of number of legs) from the source to the sink which has a positive (remaining) capacity. In this case, there are several shortest paths. ABCD is one of them. from B to C can only carry 2). It can carry 2 (as the path In the provided starter code, a path is stored in PathInfo as a string (of the vertices of the path) and the capacity of the path. Feel free to modify the starter code as desired. Part 2 For the graph, list a series of augmenting paths that produce the maximum flow in a network graph. List the final flow that was obtained. CS 2420 – Assignment 7 Page 1 In the graph above, one might list the paths: ABEFD 2 ABFD 1 To get any more flow, one has to consider pushing flow back along an edge. Thus, we would add AEBCD 2 Flow=5 This is the maximum flow that would be possible (as only five units can flow out of node A). CS 2420 – Assignment 7 Page 2 To be more efficient than the example, you are expected to use the Edmonds-Karp heuristics 1. Pick the shortest augmenting path available (for efficiency) 2. Of all same length paths (in terms of number of legs), pick the largest-capacity path available Using these heuristics, you would produce something similar to ABCD 2 AEFD 2 ABFD 1 CS 2420 – Assignment 7 Page 3
© Copyright 2026 Paperzz