You are on page 1of 16

15.082 & 6.855J & ESD.

78J Algorithm Visualization

The Ford-Fulkerson Augmenting Path Algorithm for the Maximum Flow Problem

Ford-Fulkerson Max Flow


4

2
3
2

5
1
1 2

s
3

4
1
2

3
4 3 2 s 3 4 1 3 2 1 1 2 2 5 1 t

This is the original network, and the original residual network.


3

Ford-Fulkerson Max Flow


4

2
3
2

5
1
1 2

s
3

4
1
2

3
4 3 2 s 3 4 1 3 2 1 1 2 2 5 1 t

Find any s-t path in G(x)

Ford-Fulkerson Max Flow


4

2
3
2

5
1
1 1 2

s
2 3 1

4
1

2 1

3
4 3 2 s 3 4 1 3 2 1 1 2 2 5 1 t

Determine the capacity of the path. Send units of flow in the path. Update residual capacities.
5

Ford-Fulkerson Max Flow


4

2
3
2

5
1
1 1 2

s
2 3 1

4
1

2 1

3
4 3 2 s 3 4 1 3 2 1 1 2 2 5 1 t

Find any s-t path

Ford-Fulkerson Max Flow


4

2
3
2 1

5
1
1 1 1 1

s
2 3 1

4
1

2 1 1 1

3
4 3 2 s 3 4 1 3 2 1 1 2 2 5 1 t

Determine the capacity of the path. Send units of flow in the path. Update residual capacities.
7

Ford-Fulkerson Max Flow


4

2
3
2 1

5
1
1 1 1 1

s
2 3 1

4
1

2 1 1 1

3
4 3 2 s 3 4 1 3 2 1 1 2 2 5 1 t

Find any s-t path

Ford-Fulkerson Max Flow


4

2
3
1

5
1
1 1 1 1 2

s
2 3 1

4
1

1 1 2 1

3
4 3 2 s 3 4 1 3 2 1 1 2 2 5 1 t

Determine the capacity of the path. Send units of flow in the path. Update residual capacities.
9

Ford-Fulkerson Max Flow


4

2
3
1 2

5
1
1 1 1 1 2

s
2 3 1

4
1

1 1 2 1

3
4 3 2 s 3 4 1 3 2 1 1 2 2 5 1 t

Find any s-t path

10

Ford-Fulkerson Max Flow


4

2
3
1 2

5
1
1 1 1 1 2

s
1 2 2 1

4
1
1 2 1

1 2

3
4 3 2 s 3 4 1 3 2 1 1 2 2 5 1 t

Determine the capacity of the path. Send units of flow in the path. Update residual capacities.
11

Ford-Fulkerson Max Flow


4

2
3
1 2

5
1
1 1 1 1 2

s
1 2 2 1

4
1
2 1

1 2

3
4 3 2 s 3 4 1 3 2 1 1 2 2 5 1 t

Find any s-t path

12

Ford-Fulkerson Max Flow


4 3

2
3 2
1

5
1 1

s
1 2 2 1

1 2

4
1
2 1

1 2

3
4 3 2 s 3 4 1 3 2 1 1 2 2 5 1 t

Determine the capacity of the path. Send units of flow in the path. Update residual capacities.
13

Ford-Fulkerson Max Flow


4 3

2
3 2
1

5
1 1

s
1 2 2 1

1 2

4
1
2 1

1 2

3
4 3 2 s 3 4 1 3 2 1 1 2 2 5 1 t

There is no s-t path in the residual network. This flow is optimal


14

Ford-Fulkerson Max Flow


4 3

2
3 2
1

5
1 1

s
1 2 2 1

1 2

4
1
2 1

1 2

3
4 3 2 s 3 4 1 3 2 1 1 2 2 5 1 t

These are the nodes that are reachable from node s.

15

Ford-Fulkerson Max Flow


1

2
1
2

5
1
2

s
2

4
2

3
4 3 2 s 3 4 1 3 2 1 1 2 2 5 1 t

Here is the optimal flow

16

MITOpenCourseWare http://ocw.mit.edu

15.082J / 6.855J / ESD.78J Network Optimization


Fall 2010

For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

You might also like