Lecture 26 Summary



In this lecture three Network Flow reductions are considered. All three of these problems are realistic and well-motivated, and use very different types of reductions. The point in discussing these is to see the different kinds of reductions that can be done.



This is an activity slide. You can stop the video at 4:49.

The instructor says that we assume that we have 2 planes, and we must start in Seattle in the morning and end in Seattle at night.

At 4:49, the instructor asks, "Can these two planes handle these 6 flights? How would you do it?"A student responds, "Plane 1 goes from Seattle to Denver to Salt Lake City to Los Angeles to Seattle." The instructor repeats the response.


Two flights are considered to be compatible if the same plane can be scheduled for both flights.


"Take-offs" are the same as "departures," and "landings" are the same as "arrivals."


At 10:00, the instructor asks, "Why is there capacity 1 for each edge?" A student responds, "We only need to assign one plane per flight." The instructor repeats the answer. You should stop here to let students respond.

The edges corresponding to routes get a lower bound of 1, because we must assign a plane to that route.

We add a source and a sink to the graph for each airplane, and the source corresponds to where the plane starts in the morning, while the sink corresponds to where the plane ends at night.

Here the instructor returns to slide 4 and constructs the graph for his example. This is very illustrative.

At 15:20, the instructor asks, "What flights are compatible with the Salt Lake City to Los Angeles flight?" The student response is hard to hear, but the instructor repeats it. You should stop here to let students respond.

At 17:40, the instructor says, "One of the things I really like about network flow is the diversity of things it can be applied to."



Foreground refers to the items that are closer to the camera, and background is what is farther from the camera.

At 18:50, the instructor asks, "How do we separate the foreground from the background?" A student asks, "Do we have a picture of the background?" The instructor says no, and explains that we start by looking at colors: assume that green is background and brown is foreground. A student asks, "What happens if a foreground color appears in the background?" Stop here to let students respond.


There are two considerations here:

1-Color. Green is likely to be background, brown is likely to be foreground.

2-Neighbors. A pixel and its neighbor are likely to either both be in the foreground or both be in the background.



We add edges between adjoining pixels, and add a source s and a sink t. Then for each v, we add an edge from s to v and from v to t.

Conceptually, the sink corresponds to the background, and the source corresponds to the foreground. Thus a cut associates some pixels with the background and some with the foreground.

We use network flow to find the min cut. The min cut will minimize the penalty function.


For each vertex v, we must cut either av or bv. Doing this associates v with the foreground or the background.

The instructor comments that the homework asks the students to make this algorithm interactive.

At 31:38, he asks, "Are there any questions on this?"


This is an activity slide. You can stop the video at 32:50.

The instructor comments, "This is the one that I was the most surprised that it was a network flow."

At 32:50, he asks, "Is it possible for the Dinosaurs to win?" There is no response. At 34:01, he asks, "Is it possible in these 5 games that someone won't get more than 5 wins? Why?" A student responds, "The best possible case is that the Ants win 2 more." The instructor replies, "But the Ants could lose." Another student says, "Another way of looking at it is that the maximum number of wins allowed so that no one gets more wins than the Dinosaurs is 4 (1 for the Ants, 1 for the Bees, and 2 for the Cockroaches), but there are 5 games left, so there must be 5 wins." This is the key observation; make sure that this is clear to the students.


This is an activity slide. You can stop the video at 36:29.

This activity is meant to be done quickly before you show them the right answer.

The point of the activity is to discover that the best that the Fruitflies could do is to tie, so instead of asking if they can win it might be better to ask "What is the best that they can do?"

At 36:45, a student says, "The teams don't all play the same number of games." This is not important.



The vertex AC represents games between A and C. Vertex A represents games that A wins.

There are several questions in a short period here. You can either stop for all of these, or ask the questions and re-create the ink yourself.

At 41:09, the instructor asks, "Which vertices in the second row will share an edge with AC?" A student responds, "A and C."

At 41:54, the instructor asks, "What is the meaning of the edge between AC and A?" A student responds, "The win of game AC could go to A."

At 42:23, the instructor asks, "What is the capacity of the edge from the source to AC?" A student responds, "The number of games remaining between A and C."

At 43:33, the instructor asks, "What is the capacity of the edges from the vertices in the second row to the sink?" A student responds, "The maximum number of wins that team can have without beating the Fruitflies."

At 44:44, the instructor asks, "What is the capacity of the edges from the first row of vertices to the second row of vertices?" A student responds, "infinity."

At 46:00, the instructor asks, "If I say that the max flow is 16, what does this mean?" There is no response, so the instructor says, "There are 18 remaining games, and the maximum flow is 16 (the maximum flow corresponds to the maximum number of total wins that allow the Fruitflies to win the division). Since 16<18, there is no satisfying schedule."

At 46:50, a student asks, "Can the max flow be greater than the number of games?" The instructor responds, "No, because the sum of all of the capacities is equal to the number of games."


The point of these last few lectures is that Network Flow is a powerful thing, and applies to a wide range of applications.