Skip to content

Maximum flow

networks

Level 3 of 3

Also called Edmonds-Karp algorithm and Ford-Fulkerson method.

test yourself

In a figure, the number next to the source and the sink is what has been sent so far, 0 at the start.

fresh numbers: the questions a run answers, asked again on new numbers

choose one

question 1

How much reaches G on this map, sent from A?

4332223A0BCEFG0
the answer, and why

the answer is D

A, B, C, G sends 2, A, B, F, G sends 2, and A, E, F, G sends 1, so 5.

if you chose another

  • That is A's limits added. The roads into G allow only 5.
  • That is the first way alone.
  • That is A to B and E to F, a cut of 6, 4 + 2. The roads into G make a narrower cut, 5.

question 2

How many looks does the run make on this line of 5 places, every limit 1?

1111A0BCDG0
the answer, and why

the answer is A

The first search makes 4 looks and the way fills every road. The second search makes 1 look along the full first road, so 5.

if you chose another

  • That is the first search alone.
  • That is a fan of 5, not a line.
  • That is the ways sent along, not the looks.

question 3

A way goes forwards from E to F, backwards along the road from B to F, then forwards from B to C. What does that do?

the answer, and why

the answer is C

The way takes back some of what B sent to F, and B sends that amount to C. F takes as much less from B as it takes more from E.

this tests how it works, on the learn page

if you chose another

  • Nothing moves backwards. The way only changes what is sent along which road.
  • What is sent along a road never passes its limit. Taking back leaves less sent.
  • Everything already sent stays, but for the amount taken back.

question 4

On which map does the run make the most looks? A>B 1 means a road from A to B with a limit of 1, and the last two letters are the source and the sink.

the answer, and why

the answer is A

Its searches make 3, 4, 5 and 5 looks, 17 in all. The others make 4, 8 and 1.

31122ABEF
The answer's map, from A to F.

if you chose another

  • That makes 4 looks.
  • That makes 8 looks.
  • Its one look finds A to B, and B leads nowhere.

pen and paper

question 5about 8 minutes

Send from A to H along these one-way roads, each with its limit. A to B 2, B to G 2, G to H 2. A to E 3, E to F 3, F to G 2. B to C 1, C to D 1, D to H 1.

  1. Find the first way of fewest steps, and how much it sends.
  2. Which road does the second way take back along, and how much does it send?
  3. How much is sent in all? Name a cut of that size.
a hint

After each way, keep two numbers for each road, its room and what was sent.

a worked answer

The first way is A, B, G, H. All three of its roads have a limit of 2, so it sends 2. Then no way forwards is left. The second way is A, E, F, G, B, C, D, H. It goes from G to B along that road backwards. B to C, C to D and D to H each allow only 1, so it sends 1. In all, 3. A third search finds none. What A can still reach is A, B, E, F and G. B to C and G to H leave that side, both full, and 1 + 2 is 3.

222332111ABCDEFGH
Shaded is what A can still reach at the end.

this tests how it works, on the learn page

what a full answer includes
  • A, B, G, H, sending 2.
  • B to G, taking back 1.
  • 3 in all, with a cut of size 3, such as B to C and G to H.

question 6about 6 minutes

A friend says a fan of 6 places must take only 5 looks a search, so 20 looks in all.

  1. How many ways does it send along?
  2. How many looks does each search make?
  3. How many looks in all, and where does your friend go wrong?
a hint

Count the searches first, the last one included.

a worked answer

Four places stand between, so 4 ways. A search that finds a way makes 4 looks from the source and 1 more, so 5. The last search finds none and makes 4. So 4 times 5 plus 4, which is 24. Your friend left out the last search.

Question 2: how many looks, FF, does a run make on a fan of nn places?
  1. the move: the ways

    the line:
    n−2 ways, one througheach place between\begin{gathered} n - 2 \text{ ways, one through} \\ \text{each place between} \end{gathered}
    searchlooks from Alooks from the next placeway it finds
    121A, B, F
    221A, E, F
    320none
    The fan of 4. Search 2 still looks along A to B, now full. In all, 3 + 3 + 2, which is 8.

    why it is allowed: Each way sends 1, which fills its two roads, so no place between is on a second way. While one still has room, a search finds it. For 4 places, 2.

  2. the move: a search that finds one

    the line:
    n−1 looks: n−2 from thesource, then 1 more\begin{gathered} n - 1 \text{ looks: } n - 2 \text{ from the} \\ \text{source, then 1 more} \end{gathered}

    why it is allowed: The source looks along all its roads, full or not. Then the first place between with room looks along its road to the sink, and the search ends.

  3. the move: the last search

    the line:
    n−2 looks, all fromthe source\begin{gathered} n - 2 \text{ looks, all from} \\ \text{the source} \end{gathered}

    why it is allowed: Every road from the source is full now, so the search reaches nothing more.

  4. the move: add them

    the line:
    F=(n−2)(n−1)+(n−2)F = (n - 2)(n - 1) + (n - 2)

    why it is allowed: Lines 1 to 3, a search for each way and the last one. For 4 places, 2 times 3 plus 2, which is 8.

  5. the move: take out n - 2

    the line:
    F=n(n−2)F = n(n - 2)

    why it is allowed: Both parts hold n−2n - 2, once n−1n - 1 times and once more, so nn times in all.

  6. the move: a ceiling

    the line:
    F≤n2F \le n^2

    why it is allowed: n−2n - 2 is below nn. For 4 places, FF is 8, at most 16.

  7. the move: read the bound

    the line:
    F∈O(n2)F \in O(n^2)

    why it is allowed: By line 6, with the fixed multiple 1.

  8. the move: a floor

    the line:
    F≥n22F \ge \frac{n^2}{2}

    why it is allowed: From 4 places on, n−2n - 2 is at least half of nn. For 4 places, FF is 8, at least 8.

  9. the move: read the bound

    the line:
    F∈Ω(n2)F \in \Omega(n^2)

    why it is allowed: By line 8, with the fixed multiple a half.

  10. the move: both together

    the line:
    F∈Θ(n2)F \in \Theta(n^2)

    why it is allowed: Lines 6 and 8 bound FF by the same growth, only a fixed multiple apart.

try it with a small nn: at n=4n = 4, line 4 gives F=8F = 8, which you can work out by hand

this tests where the formula comes from, on the learn page

what a full answer includes
  • 4 ways.
  • 5 looks, and 4 on the last.
  • 24, as the last search was left out.