Dinic Max Flow Algorithm Slides by Dominik Scheder Part I Dinic - - PowerPoint PPT Presentation

dinic max flow algorithm
SMART_READER_LITE
LIVE PREVIEW

Dinic Max Flow Algorithm Slides by Dominik Scheder Part I Dinic - - PowerPoint PPT Presentation

Dinic Max Flow Algorithm Slides by Dominik Scheder Part I Dinic Algorithm in General Flow Networks 2 4 2 1 3 3 1 2 3 t 3 3 1 2 s 4 4 2 1 3 3 3 3 2 4 2 1 3 3 1 2 3 t 3 3 1 2 s 4 4 2 1 3 3 3 3


slide-1
SLIDE 1

Dinic’ Max Flow Algorithm

Slides by Dominik Scheder

slide-2
SLIDE 2

Part I

Dinic’ Algorithm in General Flow Networks

slide-3
SLIDE 3

4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1

s t

2 3 2

slide-4
SLIDE 4

4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1

s t Find out which edges lie on a shortest s-t-path,

2 3 2

slide-5
SLIDE 5

4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1

s t Find out which edges lie on a shortest s-t-path,

2 3 2

slide-6
SLIDE 6

4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1

s t Find out which edges lie on a shortest s-t-path, and forget the rest for the time being.

2 3 2

slide-7
SLIDE 7

4 2 2 1 1 1 3 3 3 3 3 3 2 3 3

s t Find out which edges lie on a shortest s-t-path, and forget the rest for the time being.

slide-8
SLIDE 8

4 2 2 1 1 1 3 3 3 3 3 3 2 3 3

s t

Now lets greedily route as much flow as possible in this network!

slide-9
SLIDE 9

4 2 2 1 1 1 3 3 3 3 3 3 2 3 3

s t

slide-10
SLIDE 10

4 2 2 1 1 1 3 3 3 3 3 3 2 3 3

s t Find an s-t-path with depth-first search.

slide-11
SLIDE 11

4 2 2 1 1 1 3 3 3 3 3 3 2 3 3

s t Find an s-t-path with depth-first search.

slide-12
SLIDE 12

4 2 2 1 1 1 3 3 3 3 3 3 2 3 3

s t Find an s-t-path with depth-first search.

slide-13
SLIDE 13

4 2 2 1 1 1 3 3 3 3 3 3 2 3 3

s t Find an s-t-path with depth-first search.

slide-14
SLIDE 14

4 2 2 1 1 1 3 3 3 3 3 3 2 3 3

s t Find an s-t-path with depth-first search.

slide-15
SLIDE 15

4 2 2 1 1 1 3 3 3 3 3 3 2 3 3

s t Find an s-t-path with depth-first search. Route as much flow through it as possible: 1 unit.

slide-16
SLIDE 16

4 2 2 1 1 1 3 3 3 3 3 3 2 3 3

s t Find an s-t-path with depth-first search. Route as much flow through it as possible: 1 unit.

(1) (1) (1) (1)

slide-17
SLIDE 17

4 2 2 1 1 1 3 3 3 3 3 3 2 3 3

s t Find an s-t-path with depth-first search. Route as much flow through it as possible: 1 unit.

(1) (1) (1) (1)

Update capacities.

slide-18
SLIDE 18

3 1 2 1 1 3 3 3 3 2 3 2 3 3

s t Find an s-t-path with depth-first search. Route as much flow through it as possible: 1 unit. Update capacities.

slide-19
SLIDE 19

3 1 2 1 1 3 3 3 3 2 3 2 3 3

s t Find an s-t-path with depth-first search. Route as much flow through it as possible: 1 unit. Update capacities. Repeat!

slide-20
SLIDE 20

3 1 2 1 1 3 3 3 3 2 3 2 3 3

s t Find an s-t-path with depth-first search.

slide-21
SLIDE 21

3 1 2 1 1 3 3 3 3 2 3 2 3 3

s t Find an s-t-path with depth-first search.

slide-22
SLIDE 22

3 1 2 1 1 3 3 3 3 2 3 2 3 3

s t Find an s-t-path with depth-first search.

slide-23
SLIDE 23

3 1 2 1 1 3 3 3 3 2 3 2 3 3

s t Find an s-t-path with depth-first search.

slide-24
SLIDE 24

3 1 2 1 1 3 3 3 3 2 3 2 3 3

s t Find an s-t-path with depth-first search.

slide-25
SLIDE 25

3 1 2 1 1 3 3 3 3 2 3 2 3 3

s t Find an s-t-path with depth-first search.

slide-26
SLIDE 26

3 1 2 1 1 3 3 3 3 2 3 2 3 3

s t Find an s-t-path with depth-first search.

slide-27
SLIDE 27

3 1 2 1 1 3 3 3 3 2 3 2 3 3

s t Find an s-t-path with depth-first search. Delete dead ends.

slide-28
SLIDE 28

3 2 1 1 3 3 3 3 2 3 2 3 3

s t Find an s-t-path with depth-first search. Delete dead ends.

slide-29
SLIDE 29

3 2 1 1 3 3 3 3 2 3 2 3 3

s t Find an s-t-path with depth-first search. Delete dead ends. Route flow.

slide-30
SLIDE 30

3 2 1 1 3 3 3 3 2 3 2 3 3

s t Find an s-t-path with depth-first search. Delete dead ends. Route flow.

(1) (1) (1) (1)

slide-31
SLIDE 31

3 2 1 1 3 3 3 3 2 3 2 3 3

s t Find an s-t-path with depth-first search. Delete dead ends. Route flow.

(1) (1) (1) (1)

Update capacities.

slide-32
SLIDE 32

2 1 1 3 3 3 3 1 3 2 3 3

s t Find an s-t-path with depth-first search. Delete dead ends. Route flow. Update capacities.

slide-33
SLIDE 33

2 1 1 3 3 3 3 1 3 2 3 3

s t Find an s-t-path with depth-first search. Delete dead ends. Route flow. Update capacities. Repeat!

slide-34
SLIDE 34

2 1 1 3 3 3 3 1 3 2 3 3

s t Find an s-t-path with depth-first search.

slide-35
SLIDE 35

2 1 1 3 3 3 3 1 3 2 3 3

s t Find an s-t-path with depth-first search.

slide-36
SLIDE 36

2 1 1 3 3 3 3 1 3 2 3 3

s t Find an s-t-path with depth-first search.

slide-37
SLIDE 37

2 1 1 3 3 3 3 1 3 2 3 3

s t Find an s-t-path with depth-first search.

slide-38
SLIDE 38

2 1 1 3 3 3 3 1 3 2 3 3

s t Find an s-t-path with depth-first search.

slide-39
SLIDE 39

2 1 1 3 3 3 3 1 3 2 3 3

s t Find an s-t-path with depth-first search.

slide-40
SLIDE 40

2 1 1 3 3 3 3 1 3 2 3 3

s t Find an s-t-path with depth-first search.

slide-41
SLIDE 41

2 1 1 3 3 3 3 1 3 2 3 3

s t Find an s-t-path with depth-first search.

slide-42
SLIDE 42

2 1 1 3 3 3 3 1 3 2 3 3

s t Find an s-t-path with depth-first search.

slide-43
SLIDE 43

2 1 1 3 3 3 3 1 3 2 3 3

s t Find an s-t-path with depth-first search.

slide-44
SLIDE 44

2 1 1 3 3 3 3 1 3 2 3 3

s t Find an s-t-path with depth-first search.

slide-45
SLIDE 45

2 1 1 3 3 3 3 1 3 2 3 3

s t Find an s-t-path with depth-first search. Delete dead ends.

slide-46
SLIDE 46

1 3 3 3 3 1 3 2 3

s t Find an s-t-path with depth-first search. Delete dead ends.

slide-47
SLIDE 47

1 3 3 3 3 1 3 2 3

s t Find an s-t-path with depth-first search. Delete dead ends. Route as much flow as possible.

slide-48
SLIDE 48

1 3 3 3 3 1 3 2 3

s t Find an s-t-path with depth-first search. Delete dead ends. Route as much flow as possible.

(1) (1) (1) (1)

slide-49
SLIDE 49

1 3 3 3 3 1 3 2 3

s t Find an s-t-path with depth-first search. Delete dead ends. Route as much flow as possible.

(1) (1) (1) (1)

Update capacities.

slide-50
SLIDE 50

2 3 3 3 2 2 3

s t Find an s-t-path with depth-first search. Delete dead ends. Route as much flow as possible. Update capacities.

slide-51
SLIDE 51

2 3 3 3 2 2 3

s t Find an s-t-path with depth-first search. Delete dead ends. Route as much flow as possible. Update capacities. Repeat!

slide-52
SLIDE 52

2 3 3 3 2 2 3

s t Find an s-t-path with depth-first search.

slide-53
SLIDE 53

2 3 3 3 2 2 3

s t Find an s-t-path with depth-first search.

slide-54
SLIDE 54

2 3 3 3 2 2 3

s t Find an s-t-path with depth-first search.

slide-55
SLIDE 55

2 3 3 3 2 2 3

s t Find an s-t-path with depth-first search.

slide-56
SLIDE 56

2 3 3 3 2 2 3

s t Find an s-t-path with depth-first search.

slide-57
SLIDE 57

2 3 3 3 2 2 3

s t Find an s-t-path with depth-first search.

slide-58
SLIDE 58

2 3 3 3 2 2 3

s t Find an s-t-path with depth-first search.

slide-59
SLIDE 59

2 3 3 3 2 2 3

s t Find an s-t-path with depth-first search.

slide-60
SLIDE 60

2 3 3 3 2 2 3

s t Find an s-t-path with depth-first search.

slide-61
SLIDE 61

2 3 3 3 2 2 3

s t Find an s-t-path with depth-first search. Delete dead ends.

slide-62
SLIDE 62

2 3 3 3

s t Find an s-t-path with depth-first search. Delete dead ends.

slide-63
SLIDE 63

2 3 3 3

s t Find an s-t-path with depth-first search. Delete dead ends. Route as much flow as possible.

slide-64
SLIDE 64

2 3 3 3

s t Find an s-t-path with depth-first search. Delete dead ends. Route as much flow as possible.

(2) (2) (2) (2)

slide-65
SLIDE 65

2 3 3 3

s t Find an s-t-path with depth-first search. Delete dead ends. Route as much flow as possible.

(2) (2) (2) (2)

Update capacities.

slide-66
SLIDE 66

1 1 1

s t Find an s-t-path with depth-first search. Delete dead ends. Route as much flow as possible. Update capacities.

slide-67
SLIDE 67

1 1 1

s t Find an s-t-path with depth-first search. Delete dead ends. Route as much flow as possible. Update capacities. Repeat.

slide-68
SLIDE 68

1 1 1

s t Find an s-t-path with depth-first search.

slide-69
SLIDE 69

1 1 1

s t Find an s-t-path with depth-first search.

slide-70
SLIDE 70

1 1 1

s t Find an s-t-path with depth-first search.

slide-71
SLIDE 71

1 1 1

s t Find an s-t-path with depth-first search.

slide-72
SLIDE 72

1 1 1

s t Find an s-t-path with depth-first search.

slide-73
SLIDE 73

1 1 1

s t Find an s-t-path with depth-first search.

slide-74
SLIDE 74

1 1 1

s t Find an s-t-path with depth-first search.

slide-75
SLIDE 75

1 1 1

s t Find an s-t-path with depth-first search. Delete dead ends.

slide-76
SLIDE 76

t Find an s-t-path with depth-first search. Delete dead ends. The source s has been deleted. The phase ends.

slide-77
SLIDE 77

4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1

s t

2 3 2

slide-78
SLIDE 78

4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1

s t

2 3 2

Collect the flow of this phase.

slide-79
SLIDE 79

4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1

s t

2 3 2

Collect the flow of this phase.

slide-80
SLIDE 80

4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1

s t

2 3 2

Collect the flow of this phase.

(1) (1) (1) (1)

slide-81
SLIDE 81

4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1

s t

2 3 2

Collect the flow of this phase.

(1) (1) (1) (1)

slide-82
SLIDE 82

4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1

s t

2 3 2

Collect the flow of this phase.

(1) (1) (1) (1)

slide-83
SLIDE 83

4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1

s t

2 3 2

Collect the flow of this phase.

(1) (1) (2) (2) (1) (1)

slide-84
SLIDE 84

4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1

s t

2 3 2

Collect the flow of this phase.

(1) (1) (2) (2) (1) (1)

slide-85
SLIDE 85

4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1

s t

2 3 2

Collect the flow of this phase.

(1) (1) (2) (2) (1) (1)

slide-86
SLIDE 86

4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1

s t

2 3 2

Collect the flow of this phase.

(1) (1) (2) (3) (1) (1) (1) (1) (1)

slide-87
SLIDE 87

4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1

s t

2 3 2

Collect the flow of this phase.

(1) (1) (2) (3) (1) (1) (1) (1) (1)

slide-88
SLIDE 88

4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1

s t

2 3 2

Collect the flow of this phase.

(1) (1) (2) (3) (1) (1) (1) (1) (1)

slide-89
SLIDE 89

4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1

s t

2 3 2

Collect the flow of this phase.

(1) (1) (2) (3) (1) (1) (1) (1) (2) (1) (1) (1)

slide-90
SLIDE 90

4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1

s t

2 3 2

Collect the flow of this phase.

(1) (1) (2) (3) (1) (1) (1) (1) (2) (1) (1) (1)

slide-91
SLIDE 91

4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1

s t

2 3 2

Collect the flow of this phase.

(1) (1) (2) (3) (1) (1) (1) (1) (2) (1) (1) (1)

Observation: Only edges on a shortest s-t-path carry flow.

slide-92
SLIDE 92

4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1

s t

2 3 2

Collect the flow of this phase.

(1) (1) (2) (3) (1) (1) (1) (1) (2) (1) (1) (1)

Observation: Only edges on a shortest s-t-path carry flow. Build residual network (and introduce back edges)!

slide-93
SLIDE 93

2 1 1 1 2 2 2 3 2 4 4 2 3 3 1

s t

2 3 2

Collect the flow of this phase.

1 1 2 1 1 1 1 2 1 1 1

Observation: Only edges on a shortest s-t-path carry flow. Build residual network (and introduce back edges)!

slide-94
SLIDE 94

4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1

s t

2 3 2

slide-95
SLIDE 95

4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1

s t

2 3 2

dist(s, t) = 4 in the original network.

slide-96
SLIDE 96

2 1 1 1 2 2 2 3 2 4 4 2 3 3 1

s t

2 3 2 1 1 2 1 1 1 1 2 1 1 1

dist(s, t) = 4 in the original network.

slide-97
SLIDE 97

2 1 1 1 2 2 2 3 2 4 4 2 3 3 1

s t

2 3 2 1 1 2 1 1 1 1 2 1 1 1

dist(s, t) = 4 in the original network. Back edges go backwards. Not part of any length-4-path.

slide-98
SLIDE 98

2 1 1 1 2 2 2 3 2 4 4 2 3 3 1

s t

2 3 2 1 1 2 1 1 1 1 2 1 1 1

dist(s, t) = 4 in the original network. Back edges go backwards. Not part of any length-4-path. dist(s, t) > 4 in the residual network.

slide-99
SLIDE 99

Runtime Analysis

slide-100
SLIDE 100

dist(s, t) increases in every phase.

slide-101
SLIDE 101

dist(s, t) increases in every phase. At most n − 2 phases.

slide-102
SLIDE 102

dist(s, t) increases in every phase. At most n − 2 phases. Every phase performs a couple of depth-first searches.

slide-103
SLIDE 103

dist(s, t) increases in every phase. At most n − 2 phases. Every phase performs a couple of depth-first searches. How many?

slide-104
SLIDE 104

dist(s, t) increases in every phase. At most n − 2 phases. Every phase performs a couple of depth-first searches. How many? How much time does each take?

slide-105
SLIDE 105
  • Claim. Each phase performs at most m depth-first searches.
slide-106
SLIDE 106
  • Claim. Each phase performs at most m depth-first searches.

Proof.

slide-107
SLIDE 107
  • Claim. Each phase performs at most m depth-first searches.

Proof. There are at most m edges in the network.

slide-108
SLIDE 108
  • Claim. Each phase performs at most m depth-first searches.

Proof. There are at most m edges in the network. After every depth-first search we delete at least

  • ne edge.
slide-109
SLIDE 109
  • Claim. Each phase performs at most m depth-first searches.

Proof. There are at most m edges in the network. After every depth-first search we delete at least

  • ne edge.
slide-110
SLIDE 110
  • Observation. The ith depth-first search takes time O(n + di),

where di is the number of edges deleted as dead ends.

slide-111
SLIDE 111
  • Observation. The ith depth-first search takes time O(n + di),

where di is the number of edges deleted as dead ends. Thus, the total running time of all (at most m) depth-first searches is:

slide-112
SLIDE 112
  • Observation. The ith depth-first search takes time O(n + di),

where di is the number of edges deleted as dead ends. Thus, the total running time of all (at most m) depth-first searches is: O (m

i=1(n + di))

slide-113
SLIDE 113
  • Observation. The ith depth-first search takes time O(n + di),

where di is the number of edges deleted as dead ends. Thus, the total running time of all (at most m) depth-first searches is: O (m

i=1(n + di)) = O (nm + m i=1 di)

slide-114
SLIDE 114
  • Observation. The ith depth-first search takes time O(n + di),

where di is the number of edges deleted as dead ends. Thus, the total running time of all (at most m) depth-first searches is: O (m

i=1(n + di)) = O (nm + m i=1 di)

= O (nm + m)

slide-115
SLIDE 115
  • Observation. The ith depth-first search takes time O(n + di),

where di is the number of edges deleted as dead ends. Thus, the total running time of all (at most m) depth-first searches is: O (m

i=1(n + di)) = O (nm + m i=1 di)

= O (nm + m) = O (nm)

slide-116
SLIDE 116
  • Observation. The ith depth-first search takes time O(n + di),

where di is the number of edges deleted as dead ends. Thus, the total running time of all (at most m) depth-first searches is: O (m

i=1(n + di)) = O (nm + m i=1 di)

= O (nm + m) = O (nm) Thus, each phase takes O(nm) steps.

slide-117
SLIDE 117
  • Observation. The ith depth-first search takes time O(n + di),

where di is the number of edges deleted as dead ends. Thus, the total running time of all (at most m) depth-first searches is: O (m

i=1(n + di)) = O (nm + m i=1 di)

= O (nm + m) = O (nm) Thus, each phase takes O(nm) steps. Dinic’ algorithm performs at most n − 2 phases.

slide-118
SLIDE 118
  • Observation. The ith depth-first search takes time O(n + di),

where di is the number of edges deleted as dead ends. Thus, the total running time of all (at most m) depth-first searches is: O (m

i=1(n + di)) = O (nm + m i=1 di)

= O (nm + m) = O (nm) Thus, each phase takes O(nm) steps. Dinic’ algorithm performs at most n − 2 phases. Dinic’ algorithm performs O(n2m) steps.

slide-119
SLIDE 119
  • Theorem. Dinic’ algorithm finds a maximum flow in

O(n2m) steps.

slide-120
SLIDE 120

Part II

Dinic’ Algorithm in Unit Capacity Networks

slide-121
SLIDE 121

s t All capacities are 1

slide-122
SLIDE 122

s t All capacities are 1 k := dist(s, t). Here, k = 4.

slide-123
SLIDE 123

s t All capacities are 1 Ignore edges not on a shortest s-t-path. k := dist(s, t). Here, k = 4.

slide-124
SLIDE 124

s t All capacities are 1 Ignore edges not on a shortest s-t-path. k := dist(s, t). Here, k = 4.

slide-125
SLIDE 125

s t All capacities are 1 Ignore edges not on a shortest s-t-path. k := dist(s, t). Here, k = 4.

slide-126
SLIDE 126

s t Find s-t-path by depth-first search.

slide-127
SLIDE 127

s t Find s-t-path by depth-first search.

slide-128
SLIDE 128

s t Find s-t-path by depth-first search.

slide-129
SLIDE 129

s t Find s-t-path by depth-first search.

slide-130
SLIDE 130

s t Find s-t-path by depth-first search.

slide-131
SLIDE 131

s t Find s-t-path by depth-first search. Route 1 unit of flow.

slide-132
SLIDE 132

s t Find s-t-path by depth-first search. Route 1 unit of flow. Update capacities.

slide-133
SLIDE 133

s t Find s-t-path by depth-first search. Route 1 unit of flow. Update capacities.

slide-134
SLIDE 134

s t Find s-t-path by depth-first search. Route 1 unit of flow. Update capacities. This deletes k edges!

slide-135
SLIDE 135
  • Observation. Let k = dist(s, t). Every capacity update

removes k edges.

slide-136
SLIDE 136
  • Observation. Let k = dist(s, t). Every capacity update

removes k edges. Thus, each phase performs at most m/k depth first searches.

slide-137
SLIDE 137
  • Observation. Let k = dist(s, t). Every capacity update

removes k edges. Thus, each phase performs at most m/k depth first searches. Every depth-first search takes time O(k + di), where di is the number of edges deleted as dead ends.

slide-138
SLIDE 138
  • Observation. Let k = dist(s, t). Every capacity update

removes k edges. Thus, each phase performs at most m/k depth first searches. Every depth-first search takes time O(k + di), where di is the number of edges deleted as dead ends. Number of steps performed in phase stage is: O m/k

i=1 (k + di)

slide-139
SLIDE 139
  • Observation. Let k = dist(s, t). Every capacity update

removes k edges. Thus, each phase performs at most m/k depth first searches. Every depth-first search takes time O(k + di), where di is the number of edges deleted as dead ends. Number of steps performed in phase stage is: O m/k

i=1 (k + di)

  • = O
  • m + m/k

i=1 di

slide-140
SLIDE 140
  • Observation. Let k = dist(s, t). Every capacity update

removes k edges. Thus, each phase performs at most m/k depth first searches. Every depth-first search takes time O(k + di), where di is the number of edges deleted as dead ends. Number of steps performed in phase stage is: O m/k

i=1 (k + di)

  • = O
  • m + m/k

i=1 di

  • = O(m).
slide-141
SLIDE 141
  • Observation. Let k = dist(s, t). Every capacity update

removes k edges. Thus, each phase performs at most m/k depth first searches. Every depth-first search takes time O(k + di), where di is the number of edges deleted as dead ends. Number of steps performed in phase stage is: O m/k

i=1 (k + di)

  • = O
  • m + m/k

i=1 di

  • = O(m).

There are at most n − 2 phases.

slide-142
SLIDE 142
  • Theorem. On a network in which all capacities are 1,

Dinic’ algorithm finds a maximum flow in O(nm) steps.

slide-143
SLIDE 143
  • Theorem. On a network in which all capacities are 1,

Dinic’ algorithm finds a maximum flow in O(nm) steps. even better: Lemma 1. On a network with unit capacities, Dinic’ algorithm performs at most √m phases, and thus O(m1.5) steps.

slide-144
SLIDE 144
  • Theorem. On a network in which all capacities are 1,

Dinic’ algorithm finds a maximum flow in O(nm) steps. even better: Lemma 1. On a network with unit capacities, Dinic’ algorithm performs at most √m phases, and thus O(m1.5) steps. Lemma 2. On a network with unit capacities, Dinic’ algorithm performs at most O

  • n2/3

phases, and thus O(n2/3m) steps.

slide-145
SLIDE 145

Part III

Number of Phases in Unit Capacity Networks

slide-146
SLIDE 146

Lemma 1. On a network with unit capacities, Dinic’ algorithm performs at most 2√m phases, and thus O(m1.5) steps.

slide-147
SLIDE 147

Lemma 1. On a network with unit capacities, Dinic’ algorithm performs at most 2√m phases, and thus O(m1.5) steps.

  • Proof. Let t ∈ N, to be determined later.
slide-148
SLIDE 148

Lemma 1. On a network with unit capacities, Dinic’ algorithm performs at most 2√m phases, and thus O(m1.5) steps.

  • Proof. Let t ∈ N, to be determined later.

Consider Gt, the residual network after t phases.

slide-149
SLIDE 149

Lemma 1. On a network with unit capacities, Dinic’ algorithm performs at most 2√m phases, and thus O(m1.5) steps.

  • Proof. Let t ∈ N, to be determined later.

Consider Gt, the residual network after t phases. k := dist(s, t) ≥ t in Gt.

slide-150
SLIDE 150

Lemma 1. On a network with unit capacities, Dinic’ algorithm performs at most 2√m phases, and thus O(m1.5) steps.

  • Proof. Let t ∈ N, to be determined later.

Consider Gt, the residual network after t phases. k := dist(s, t) ≥ t in Gt. Vi := {v | dist(s, v) = i in Gt}.

slide-151
SLIDE 151

Lemma 1. On a network with unit capacities, Dinic’ algorithm performs at most 2√m phases, and thus O(m1.5) steps.

  • Proof. Let t ∈ N, to be determined later.

Consider Gt, the residual network after t phases. k := dist(s, t) ≥ t in Gt. Vi := {v | dist(s, v) = i in Gt}. s t . . . . . . . . . . . . V0 V1 Vi Vi+1 Vk+1 Vk

slide-152
SLIDE 152

Vi := {v | dist(s, v) = i in Gt}. s t . . . . . . . . . . . . V0 V1 Vi Vi+1 Vk+1 Vk

slide-153
SLIDE 153

Vi := {v | dist(s, v) = i in Gt}. s t . . . . . . . . . . . . V0 V1 Vi Vi+1 Vk+1 Vk Ei := {(u, v) ∈ E | u ∈ Vi, v ∈ Vi+1}

slide-154
SLIDE 154

Vi := {v | dist(s, v) = i in Gt}. s t . . . . . . . . . . . . V0 V1 Vi Vi+1 Vk+1 Vk Ei := {(u, v) ∈ E | u ∈ Vi, v ∈ Vi+1}

slide-155
SLIDE 155

Vi := {v | dist(s, v) = i in Gt}. s t . . . . . . . . . . . . V0 V1 Vi Vi+1 Vk+1 Vk Ei := {(u, v) ∈ E | u ∈ Vi, v ∈ Vi+1} |E0| + |E1| + . . . + |Ek−1| ≤ m.

slide-156
SLIDE 156

Vi := {v | dist(s, v) = i in Gt}. s t . . . . . . . . . . . . V0 V1 Vi Vi+1 Vk+1 Vk Ei := {(u, v) ∈ E | u ∈ Vi, v ∈ Vi+1} |E0| + |E1| + . . . + |Ek−1| ≤ m. |Ei| ≤ m

k ≤ m t for some i.

slide-157
SLIDE 157

Vi := {v | dist(s, v) = i in Gt}. s t . . . . . . . . . . . . V0 V1 Vi Vi+1 Vk+1 Vk Ei := {(u, v) ∈ E | u ∈ Vi, v ∈ Vi+1} |E0| + |E1| + . . . + |Ek−1| ≤ m. |Ei| ≤ m

k ≤ m t for some i.

S := V0 ∪ V1 ∪ . . . ∪ Vi. is an s-t-cut!

slide-158
SLIDE 158

Vi := {v | dist(s, v) = i in Gt}. s t . . . . . . . . . . . . V0 V1 Vi Vi+1 Vk+1 Vk Ei := {(u, v) ∈ E | u ∈ Vi, v ∈ Vi+1} |E0| + |E1| + . . . + |Ek−1| ≤ m. |Ei| ≤ m

k ≤ m t for some i.

S := V0 ∪ V1 ∪ . . . ∪ Vi. cap(S, V \ S) = |Ei| ≤ m

t .

is an s-t-cut!

slide-159
SLIDE 159

Vi := {v | dist(s, v) = i in Gt}. s t . . . . . . . . . . . . V0 V1 Vi Vi+1 Vk+1 Vk Ei := {(u, v) ∈ E | u ∈ Vi, v ∈ Vi+1} |E0| + |E1| + . . . + |Ek−1| ≤ m. |Ei| ≤ m

k ≤ m t for some i.

S := V0 ∪ V1 ∪ . . . ∪ Vi. cap(S, V \ S) = |Ei| ≤ m

t .

maxflow(Gt) ≤ m

t .

is an s-t-cut!

slide-160
SLIDE 160

Gt := the residual network after t phases.

slide-161
SLIDE 161

Gt := the residual network after t phases. maxflow(Gt) ≤ m

t .

slide-162
SLIDE 162

Gt := the residual network after t phases. maxflow(Gt) ≤ m

t .

Every phase increases the flow by at least 1.

slide-163
SLIDE 163

Gt := the residual network after t phases. maxflow(Gt) ≤ m

t .

Every phase increases the flow by at least 1. At most t + m

t phases.

slide-164
SLIDE 164

Gt := the residual network after t phases. maxflow(Gt) ≤ m

t .

Every phase increases the flow by at least 1. At most t + m

t phases.

At most 2√m phases (setting t = √m).

slide-165
SLIDE 165

Gt := the residual network after t phases. maxflow(Gt) ≤ m

t .

Every phase increases the flow by at least 1. At most t + m

t phases.

At most 2√m phases (setting t = √m). Lemma 1. On a network with unit capacities, Dinic’ algorithm performs at most 2√m phases, and thus O(m1.5) steps.

slide-166
SLIDE 166

Gt := the residual network after t phases. maxflow(Gt) ≤ m

t .

Every phase increases the flow by at least 1. At most t + m

t phases.

At most 2√m phases (setting t = √m). Lemma 1. On a network with unit capacities, Dinic’ algorithm performs at most 2√m phases, and thus O(m1.5) steps.

slide-167
SLIDE 167

Lemma 2. On a network with unit capacities, Dinic’ algorithm performs at most O

  • n2/3

phases, and thus O(n2/3m) steps.

slide-168
SLIDE 168

Lemma 2. On a network with unit capacities, Dinic’ algorithm performs at most O

  • n2/3

phases, and thus O(n2/3m) steps. Proof.

slide-169
SLIDE 169

Lemma 2. On a network with unit capacities, Dinic’ algorithm performs at most O

  • n2/3

phases, and thus O(n2/3m) steps.

  • Proof. Vi := {v | dist(s, v) = i in Gt}.

s t . . . . . . . . . . . . V0 V1 Vi Vi+1 Vk+1 Vk

slide-170
SLIDE 170

Lemma 2. On a network with unit capacities, Dinic’ algorithm performs at most O

  • n2/3

phases, and thus O(n2/3m) steps.

  • Proof. Vi := {v | dist(s, v) = i in Gt}.

s t . . . . . . . . . . . . V0 V1 Vi Vi+1 Vk+1 Vk Vi is big if |Vi| ≥ 2n/k.

slide-171
SLIDE 171

Lemma 2. On a network with unit capacities, Dinic’ algorithm performs at most O

  • n2/3

phases, and thus O(n2/3m) steps.

  • Proof. Vi := {v | dist(s, v) = i in Gt}.

s t . . . . . . . . . . . . V0 V1 Vi Vi+1 Vk+1 Vk Vi is big if |Vi| ≥ 2n/k. At most

n 2n/k = k 2 sets Vi can be big.

slide-172
SLIDE 172

s t . . . . . . . . . . . . V0 V1 Vi Vi+1 Vk+1 Vk Vi is big if |Vi| ≥ 2n/k. At most

n 2n/k = k 2 sets Vi can be big.

slide-173
SLIDE 173

s t . . . . . . . . . . . . V0 V1 Vi Vi+1 Vk+1 Vk Vi is big if |Vi| ≥ 2n/k. At most

n 2n/k = k 2 sets Vi can be big.

Thus, V0, . . . , Vk contains two consecutive “small” sets Vi, Vi+1. . . . . . . Vi Vi+1

slide-174
SLIDE 174

s t . . . . . . . . . . . . V0 V1 Vi Vi+1 Vk+1 Vk Vi is big if |Vi| ≥ 2n/k. At most

n 2n/k = k 2 sets Vi can be big.

Thus, V0, . . . , Vk contains two consecutive “small” sets Vi, Vi+1. |E(Vi, Vi+1)| ≤ |Vi| · |Vi+1| ≤ 4n2

k2 .

. . . . . . Vi Vi+1

slide-175
SLIDE 175

s t . . . . . . . . . . . . V0 V1 Vi Vi+1 Vk+1 Vk Vi is big if |Vi| ≥ 2n/k. At most

n 2n/k = k 2 sets Vi can be big.

Thus, V0, . . . , Vk contains two consecutive “small” sets Vi, Vi+1. |E(Vi, Vi+1)| ≤ |Vi| · |Vi+1| ≤ 4n2

k2 .

. . . . . . Vi Vi+1 S := V0 ∪ V1 ∪ . . . Vi is an s-t-cut.

slide-176
SLIDE 176

s t . . . . . . . . . . . . V0 V1 Vi Vi+1 Vk+1 Vk Vi is big if |Vi| ≥ 2n/k. At most

n 2n/k = k 2 sets Vi can be big.

Thus, V0, . . . , Vk contains two consecutive “small” sets Vi, Vi+1. |E(Vi, Vi+1)| ≤ |Vi| · |Vi+1| ≤ 4n2

k2 .

. . . . . . Vi Vi+1 S := V0 ∪ V1 ∪ . . . Vi is an s-t-cut. cap(S, V \ S) ≤ 4n2

k2 ≤ 4n2 t2 .

slide-177
SLIDE 177

s t . . . . . . . . . . . . V0 V1 Vi Vi+1 Vk+1 Vk Vi is big if |Vi| ≥ 2n/k. At most

n 2n/k = k 2 sets Vi can be big.

Thus, V0, . . . , Vk contains two consecutive “small” sets Vi, Vi+1. |E(Vi, Vi+1)| ≤ |Vi| · |Vi+1| ≤ 4n2

k2 .

. . . . . . Vi Vi+1 S := V0 ∪ V1 ∪ . . . Vi is an s-t-cut. cap(S, V \ S) ≤ 4n2

k2 ≤ 4n2 t2 .

maxflow(Gt) ≤

slide-178
SLIDE 178

Gt := the residual network after t phases.

slide-179
SLIDE 179

Gt := the residual network after t phases. maxflow(Gt) ≤ 4n2

t2 .

slide-180
SLIDE 180

Gt := the residual network after t phases. maxflow(Gt) ≤ 4n2

t2 .

Every phase increases the flow by at least 1.

slide-181
SLIDE 181

Gt := the residual network after t phases. maxflow(Gt) ≤ 4n2

t2 .

Every phase increases the flow by at least 1. At most t + 4n2

t2 phases.

slide-182
SLIDE 182

Gt := the residual network after t phases. maxflow(Gt) ≤ 4n2

t2 .

Every phase increases the flow by at least 1. At most t + 4n2

t2 phases.

At most 5n2/3 phases (setting t = n2/3).

slide-183
SLIDE 183

Gt := the residual network after t phases. maxflow(Gt) ≤ 4n2

t2 .

Every phase increases the flow by at least 1. At most t + 4n2

t2 phases.

At most 5n2/3 phases (setting t = n2/3). Lemma 2. On a network with unit capacities, Dinic’ algorithm performs at most O

  • n2/3

phases, and thus O(n2/3m) steps.

slide-184
SLIDE 184

Gt := the residual network after t phases. maxflow(Gt) ≤ 4n2

t2 .

Every phase increases the flow by at least 1. At most t + 4n2

t2 phases.

At most 5n2/3 phases (setting t = n2/3). Lemma 2. On a network with unit capacities, Dinic’ algorithm performs at most O

  • n2/3

phases, and thus O(n2/3m) steps.

slide-185
SLIDE 185
  • Theorem. Dinic’ algorithm finds a maximum flow in

O(n2m) steps.

  • Theorem. On a network with unit capacities, Dinic’

algorithm finds a maximum flow in O(m1.5) steps.

  • Theorem. On a network with unit capacities, Dinic’

algorithm finds a maximum flow in O(n2/3m) steps.