What you misses! Something very valuable was missing in a lab. There were 6 RA ’ s (A, B, C, D, E, F) working in the lab that night. If two persons are.

Slides:



Advertisements
Similar presentations
Maximum flow Main goals of the lecture:
Advertisements

Lecture 7. Network Flows We consider a network with directed edges. Every edge has a capacity. If there is an edge from i to j, there is an edge from.
Bipartite Matching, Extremal Problems, Matrix Tree Theorem.
15.082J & 6.855J & ESD.78J October 14, 2010 Maximum Flows 2.
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
1 Maximum flow sender receiver Capacity constraint Lecture 6: Jan 25.
Bioinformatics III1 We will present an algorithm that originated by Ford and Fulkerson (1962). Idea: increase the flow in a network iteratively until it.
Chapter 6 Maximum Flow Problems Flows and Cuts Augmenting Path Algorithm.
CSE 421 Algorithms Richard Anderson Lecture 23 Network Flow Applications.
Introduction To Algorithms CS 445 Discussion Session 8 Instructor: Dr Alon Efrat TA : Pooja Vaswani 04/04/2005.
MAXIMUM FLOW Max-Flow Min-Cut Theorem (Ford Fukerson’s Algorithm)
Prof. Swarat Chaudhuri COMP 482: Design and Analysis of Algorithms Spring 2012 Lecture 19.
CSCI 256 Data Structures and Algorithm Analysis Lecture 18 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some.
Chapter 10: Iterative Improvement The Maximum Flow Problem The Design and Analysis of Algorithms.
1 Maximum Flow w s v u t z 3/33/3 1/91/9 1/11/1 3/33/3 4/74/7 4/64/6 3/53/5 1/11/1 3/53/5 2/22/2 
1 Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Advanced Algorithm Design and Analysis (Lecture 8) SW5 fall 2004 Simonas Šaltenis E1-215b
Lectures on Network Flows
1 Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Chapter 7 Maximum Flows: Polynomial Algorithms
HW2 Solutions. Problem 1 Construct a bipartite graph where, every family represents a vertex in one partition, and table represents a vertex in another.
The max flow problem
Maximum Flows Lecture 4: Jan 19. Network transmission Given a directed graph G A source node s A sink node t Goal: To send as much information from s.
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
MAX FLOW CS302, Spring 2013 David Kauchak. Admin.
CS774. Markov Random Field : Theory and Application Lecture 13 Kyomin Jung KAIST Oct
1 COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf.
CS 473Lecture ?1 CS473-Algorithms I Lecture ? Network Flows Finding Max Flow.
MAX FLOW APPLICATIONS CS302, Spring 2012 David Kauchak.
Max Flow – Min Cut Problem. Directed Graph Applications Shortest Path Problem (Shortest path from one point to another) Max Flow problems (Maximum material.
1 WEEK 11 Graphs III Network Flow Problems A Simple Maximum-Flow Algorithm Izmir University of Economics.
Maximum Flow Problem (Thanks to Jim Orlin & MIT OCW)
CS223 Advanced Data Structures and Algorithms 1 Maximum Flow Neil Tang 3/30/2010.
Chapter 7 April 28 Network Flow.
15.082J & 6.855J & ESD.78J October 7, 2010 Introduction to Maximum Flows.
15.082J and 6.855J March 4, 2003 Introduction to Maximum Flows.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 25.
and 6.855J March 6, 2003 Maximum Flows 2. 2 Network Reliability u Communication Network u What is the maximum number of arc disjoint paths from.
10/11/10 A. Smith; based on slides by E. Demaine, C. Leiserson, S. Raskhodnikova, K. Wayne Adam Smith Algorithm Design and Analysis L ECTURE 21 Network.
Algorithm Design and Analysis (ADA)
Chapter 7 May 3 Ford-Fulkerson algorithm Step-by-step walk through of an example Worst-case number of augmentations Edmunds-Karp modification Time complexity.
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
CSEP 521 Applied Algorithms Richard Anderson Lecture 8 Network Flow.
1 Network Flow CSC401 – Analysis of Algorithms Chapter 8 Network Flow Objectives: Flow networks –Flow –Cut Maximum flow –Augmenting path –Maximum flow.
Fall 2003Maximum Flow1 w s v u t z 3/33/3 1/91/9 1/11/1 3/33/3 4/74/7 4/64/6 3/53/5 1/11/1 3/53/5 2/22/2 
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
Prof. Swarat Chaudhuri COMP 382: Reasoning about Algorithms Fall 2015.
Theory of Computing Lecture 12 MAS 714 Hartmut Klauck.
Iterative Improvement for Domain-Specific Problems Lecturer: Jing Liu Homepage:
Ford-Fulkerson Recap.
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
Algorithms and Networks
Lectures on Network Flows
Richard Anderson Lecture 23 Network Flow
Maximum Flow 9/13/2018 6:12 PM Presentation for use with the textbook, Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015.
Lecture 22 Network Flow, Part 2
Chapter 5. Optimal Matchings
Instructor: Shengyu Zhang
Edmonds-Karp Algorithm
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Richard Anderson Lecture 21 Network Flow
Algorithms (2IL15) – Lecture 7
EE5900 Advanced Embedded System For Smart Infrastructure
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
Lecture 21 Network Flow, Part 1
Maximum Flow Neil Tang 4/8/2008
Lecture 22 Network Flow, Part 2
Richard Anderson Lecture 22 Network Flow
Presentation transcript:

What you misses! Something very valuable was missing in a lab. There were 6 RA ’ s (A, B, C, D, E, F) working in the lab that night. If two persons are in the lab at the same time, at least one will see the other. No one can reenter the lab (every RA stays for a consecutive period of time). Upon investigation, each of them claims: A saw B,D. B saw A. C saw F. D saw A, B, C. E saw B, F. F saw B. Suppose there is only one liar among the RA ’ s who saw someone and did not tell. Can you identify a liar? Explain.

The investigation Construct a graph indicating the time overlap relations among the RA ’ s. The graph should be an interval graph like the one below. A F E D C B

But there is an induced cycle of length 4 (BDCF), E F B CD A Either B or C lied!This is not an interval graph! A saw B,D. B saw A. C saw F. D saw A, B, C. E saw B, F. F saw B.

What you probably won ’ t miss! (In the exam?) Which of the following is a DFS (BFS) sequence of Fig. 1? Find an augmenting path in Fig.2. Is the interval graph based on the model shown in Fig.3 Eulerian? What can we say about the time complexity for recognizing interval graphs when we know that there is a O(nm) time for recognizing a circular-arc graph. (Interval graph is a subset of circular-arc graph.) Find a min-cut on a network. None of these above.

Network flow and Matching The problems that are hard but can be solved by poly-time algorithms. Rich applications. The area where graph algorithms meet linear programming (operating research).

Outline Bipartite matching. Network flow. Ford and Fulkerson ’ s algorithm. Max-flow Min-cut theorem. Efficient algorithms. General Matching Applications.

a d c b e a b c d e Matching Making Service (MaMaServ)

a d c b e e d c b a Matching Making Service (MaMaServ)

f joins in at the last minute a d c b e Matching Making Service a b c d e f f

a d c b f e f e d c b a Matching Making Service

a d c b f e f e d c b a Matching Making Service

a d c b f e f e d c b a Matching Making Service

a d c b f e f e d c b a Matching Making Service

a d c b f e f e d c b a Matching Making Service

a d c b f e f e d c b a Matching Making Service

a d c b f e f e d c b a Matching Making Service

General Techniques for Flow and Matching Starting from a feasible solution. Get a better solution by finding an augmenting path. What ’ s the difference from a greedy method? In a greedy algorithm, a decision will not be changed by subsequent operations.

Augmenting Path in Bipartite Matching Given a (partial) matching M in a graph G, an augmenting path is a path with even number of vertices (odd number of edges) such that the two end point are unmatched vertices and the edges in the path are composed by unmatched and matched edges alternatively.

Augmenting path. Repeat find an augmenting path modify the matching Until there is no augmenting path A path with odd length where both endpoints are not matched And all other vertices are matched.

a d c b f e is an augmenting path! a-4 c-2 d-3 e-6 f-5

b 2 6 a d c b f e c e 5 4 a d f 3 1 Using BFS-like strategy to find an augmenting path Complexity O(Fm) F=the cardinality of matching. O(nm)

Proof of correctness Suppose we cannot find any augmentation path in a bipartite graph and the cardinality is not maximum. Denote the maximum matching by red edges and our partial result by blue edges. Consider all possible relations of the two sets of edges.

a d c b f e Must have a augmenting path! Compare each red edge with blue matching. Pick a red edge, if it was a blue edge, ignore. If it does not contain a matched edge, it is an augmenting path! Otherwise, traverse alone the matched edge…

st Capacity c(e). Feasible solution Capacity constraint : 0<= f(e) <= c(e) for each e Conservation constraint: f in (v) = f out (v) for each v (except s, t) Transportation Network

st A forward augmenting path is a directed Path from s to t using forward edges. A flow is maximal if there is no Forward augmenting path.

st 1/3 1/ /3 2 1 A backward edge is added in the reversal to the direction of the flow.

s t 10. yx Cannot increase the flow without decrease the flow in certain edge.

s t 10. yx Redirection must be considered on existing flows.

What do we mean by including a backward edge in an augmenting path?

The flow can be increased by reverting some previously allocated flow on a back edge.

+

Augmenting path: Forward and backward edges. The gain by adding an augmenting path is the minimum of the remaining capacity of a forward edge or the flow of a backward edge. Update: increase the gain on the forward edges and subtract the gain from the existing flow of the backward edges.

Ford and Fulkerson Find an augmenting path. Update the flow and data structure. Until no augmenting path can be found. Correctness: max-flow min-cut theorem.

Residual Graph The graph that we consider in the flow algorithm. Consists both forward and backward edges (NO DIFFERENCE). Updated when each augmenting path is selected.

Critical edge

1 1/

The Ford-Fulkerson algorithm might not terminate(if the initial values are not rational). First poly-time algorithm is given by Edmonds and Karp.

The worst case? s t s-x-y-t path. yx

1000 1

1

Time complexity is O(Um) where U is the max-flow. NOT polynomial!

s t Min-Cut? A cut of 20

s t Min-Cut? A cut of 18

Max-flow min-cut theorem (Constructive proof by Ford and Fulkerson) (1) Any augmentation path will increase the total flow. (2) When there is no augmentation path can be found in the residual graph, the flow equals a cut. (3) Any flow is not greater than the min- cut.

3 1/ A min cut!

s t Finished Initial s t

Now we proved the algorithm is correct, what about the time complexity? Use a good ordering strategy to avoid repeating.

Choose an augmenting path with shortest length (number of edges) Perform a BFS on a residual graph starting form s. Partition all vertices by their shortest distance to s. The result is called a “ k-level graph ” if the distance between s and t is k.

ST C1C1 C k-1 C2C2 The edges between consecutive layers are called “feasible”. Only feasible edges are considered to find an augmenting path.

ST C1C1 C k-1 C2C2 Critical edge

ST C1C1 C k-1 C2C2

Key ideas Each augmenting path identifies at least one “ critical edge ”. If we update the k-level graph by an augmentation path, the critical edge will be eliminated from feasible edge set. No new feasible edge will be generated by the process.

After a k-level graph runs out of augmenting path, the next graph generated will have k-1 levels or less. Each has only one chance to become critical. BFS search for an augmenting path takes O(m) time. Time complexity is thus O(m 2 )

Complexity of Network Flow Algorithms nm 2 - Edmonds, Karp 1972 n 2 m – Dinits 1970 n 3 Karvanov 1974 n 2 m ½ - Cherkaski 1977 n 5/3 m 2/3 - Galil 1978 nmlog 2 n – Galil, Naamad 1979 Shiloach 1978 nmlogn – Sleator 1980

A bipartite matching problem can be solved by network flow a d c b f e

a d c b f e st Each edge has capacity 1 Max flow equals maximum cardinality.

Operations within a domain Integer number is closed under addition, subtraction, and multiplication. Rational number is closed under “ +, -, *, / ”

Integral flow: the result will be in integral. By Ford and Fulkerson. Since at each step, the change of the values are always integral. Bipartite cardinality -> Integral flow.

The Fair Meal Problem Alice, Bob, David, Elsa, and Frank are having a food fight in an restaurant. They want to make orders with a diverse combination of different food types. Everybody insists there must be at least one dish to please him/her. Can you help them to stop the foolish arguments?

Alice Bob David Elsa Frank Vegetables Meats Sea Foods Poultry Appetizers Sweet and Sour Fish Khorma NO. 4 NO. 23. NO.37 s t

General Matching During the WWII, the union air force have a problem. They had an assembly of pilots who speak different languages (French, English, Spanish, … ). Each mission requires two crew members and they ’ d better to be able to communicate by one language. How to divide all pilots into teams such that the available teams is maximum?

Matching on general graph (in this case, the intersection graph of the language set of each pilot.) Solving matching on general graph is more complicated since there are “ flowers ”. The complexities have very little difference!

u v

b

b1 b’

10789 b1

References Combinatorial Optimization – Papadimitriou and Steiglitz Network Flows – Ahuja, Magnanti, and Orlin Introduction to Combinatorial Mathematics – Liu Graph Theory with Application – Bondu and Murty Introduction to Graph Theory – West Introduction to Algorithms – Corman, Leiserson, and Rivest