informatik ii
play

Informatik II Ubung 11 FS 2020 1 Program Today Feedback of - PowerPoint PPT Presentation

Informatik II Ubung 11 FS 2020 1 Program Today Feedback of last exercise 1 Repetition of Lecture 2 In-Class-Exercise (practical) 3 2 1. Feedback of last exercise 3 2. Repetition of Lecture 4 Flow A Flow f : V V


  1. Informatik II ¨ Ubung 11 FS 2020 1

  2. Program Today Feedback of last exercise 1 Repetition of Lecture 2 In-Class-Exercise (practical) 3 2

  3. 1. Feedback of last exercise 3

  4. 2. Repetition of Lecture 4

  5. Flow A Flow f : V × V → ❘ fulfills the following conditions: 12 / 12 v 1 v 3 Bounded Capacity : 20 / 14 16 / 8 For all u, v ∈ V : f ( u, v ) ≤ c ( u, v ) . s 4 / 4 7 / 6 t 9 / 4 Skew Symmetry : 4 / 4 13 / 10 For all u, v ∈ V : f ( u, v ) = − f ( v, u ) . v 2 v 4 14 / 10 Conservation of flow : For all u ∈ V \ { s, t } : Value of the flow: | f | = � v ∈ V f ( s, v ) . Here | f | = 18 . � f ( u, v ) = 0 . v ∈ V 5

  6. Rest Network Rest network G f provided by the edges with positive rest capacity: 12 v 1 v 3 8 14 4 8 6 s 4 1 6 t 5 3 12 / 12 v 1 v 3 16 / 8 20 / 14 4 4 s 4 / 4 7 / 6 t v 2 v 4 10 9 / 4 13 / 10 4 / 4 v 2 v 4 10 14 / 10 Rest networks provide the same kind of properties as flow networks with the exception of permitting antiparallel capacity-edges 6

  7. Augmenting Paths expansion path p : simple path from s to t in the rest network G f . Rest capacity c f ( p ) = min { c f ( u, v ) : ( u, v ) edge in p } 7

  8. Max-Flow Min-Cut Theorem Theorem Let f be a flow in a flow network G = ( V, E, c ) with source s and sink t . The following statementsa are equivalent: 1 f is a maximal flow in G 2 The rest network G f does not provide any expansion paths 3 It holds that | f | = c ( S, T ) for a cut ( S, T ) of G . 8

  9. Algorithm Ford-Fulkerson( G, s, t ) Input: Flow network G = ( V, E, c ) Output: Maximal flow f . for ( u, v ) ∈ E do f ( u, v ) ← 0 while Exists path p : s � t in rest network G f do c f ( p ) ← min { c f ( u, v ) : ( u, v ) ∈ p } foreach ( u, v ) ∈ p do f ( u, v ) ← f ( u, v ) + c f ( p ) f ( v, u ) ← f ( v, u ) − c f ( p ) 9

  10. Practical Consideration In an implementation of the Ford-Fulkerson algorithm the negative flow egdes do not necessarily have to be store because their value always equals the negated value of the antiparallel edge. f ( u, v ) ← f ( u, v ) + c f ( p ) f ( v, u ) ← f ( v, u ) − c f ( p ) is then transformed to if ( u, v ) ∈ E then f ( u, v ) ← f ( u, v ) + c f ( p ) else f ( v, u ) ← f ( v, u ) − c f ( p ) 10

  11. Edmonds-Karp Algorithm Choose in the Ford-Fulkerson-Method for finding a path in G f the expansion path of shortest possible length (e.g. with BFS) 11

  12. Edmonds-Karp Algorithm Theorem When the Edmonds-Karp algorithm is applied to some integer valued flow network G = ( V, E ) with source s and sink t then the number of flow increases applied by the algorithm is in O ( | V | · | E | ) . ⇒ Overal asymptotic runtime: O ( | V | · | E | 2 ) [Without proof] 12

  13. Application: maximal bipartite matching Given: bipartite undirected graph G = ( V, E ) . Matching M : M ⊆ E such that |{ m ∈ M : v ∈ m }| ≤ 1 for all v ∈ V . Maximal Matching M : Matching M , such that | M | ≥ | M ′ | for each matching M ′ . 13

  14. 3. In-Class-Exercise (practical) Implementation of Max-Flow 14

  15. Max-Flow Implementation 15

  16. Questions? 16

Recommend


More recommend