HW2 Solutions. Problem 1 Construct a bipartite graph where, every family represents a vertex in one partition, and table represents a vertex in another.

Slides:



Advertisements
Similar presentations
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.
Advertisements

Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: uij is the capacity on arc (i,j). Find non-negative flow fij for.
Introduction to Algorithms
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.
EMIS 8374 Vertex Connectivity Updated 20 March 2008.
Chapter 6 Maximum Flow Problems Flows and Cuts Augmenting Path Algorithm.
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.
Chapter 10: Iterative Improvement The Maximum Flow Problem The Design and Analysis of Algorithms.
Lectures on Network Flows
1 Maximum Flow Networks Suppose G = (V, E) is a directed network. Each edge (i,j) in E has an associated ‘capacity’ u ij. Goal: Determine the maximum amount.
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
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.
Network Flow & Linear Programming Jeff Edmonds York University Adapted from NetworkFlow.ppt.
Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
CSEP 521 Applied Algorithms
Minimum Spanning Trees. Subgraph A graph G is a subgraph of graph H if –The vertices of G are a subset of the vertices of H, and –The edges of G are a.
Flow Networks Formalization Basic Results Ford-Fulkerson Edmunds-Karp Bipartite Matching Min-cut.
Homework 2. Problem 1 Families 1…..N go out for dinner together. To increase their social interaction, no two members of the same family use the same.
CSE 421 Algorithms Richard Anderson Lecture 24 Network Flow Applications.
Maximization of Network Survivability against Intelligent and Malicious Attacks (Cont’d) Presented by Erion Lin.
Solution to HW1. Problem 1 Need to find shortest path from a single source s to a single destination d. Have a condition in the Dijkstra algo loop which.
Network Flow. Network flow formulation A network G = (V, E). Capacity c(u, v)  0 for edge (u, v). Assume c(u, v) = 0 if (u, v)  E. Source s and sink.
Maximum Flow. p2. Maximum Flow A flow network G=(V, E) is a DIRECTED graph where each has a nonnegative capacity u.
Max Flow – Min Cut Problem. Directed Graph Applications Shortest Path Problem (Shortest path from one point to another) Max Flow problems (Maximum material.
Maximum Flow Problem (Thanks to Jim Orlin & MIT OCW)
CS223 Advanced Data Structures and Algorithms 1 Maximum Flow Neil Tang 3/30/2010.
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.
Algorithm Design and Analysis (ADA)
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
Data Structures & Algorithms Network Flow Richard Newman based on book by R. Sedgewick.
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.
CS 312: Algorithm Design & Analysis Lecture #29: Network Flow and Cuts This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported.
Contest Algorithms January 2016 Describe the maxflow problem, explain the Ford-Fulkerson, Edmonds-Karp algorithms. Look at the mincut problem, bipartite.
TU/e Algorithms (2IL15) – Lecture 8 1 MAXIMUM FLOW (part II)
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
CS4234 Optimiz(s)ation Algorithms
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
Network Flow 2016/04/12.
Instructor: Shengyu Zhang
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
Richard Anderson Lecture 23 Network Flow
Richard Anderson Lecture 23 Network Flow
Vertex Covers, Matchings, and Independent Sets
Richard Anderson Lecture 21 Network Flow
Problem Solving 4.
Max Flow Min Cut, Bipartite Matching Yin Tat Lee
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
Network Flow.
Lecture 21 Network Flow, Part 1
Richard Anderson Lecture 22 Network Flow
Lecture 21 Network Flow, Part 1
Lecture 22 Network Flow, Part 2
Network Flow.
Richard Anderson Lecture 22 Network Flow
Maximum Flow Problems in 2005.
Vertex Covers and Matchings
Presentation transcript:

HW2 Solutions

Problem 1 Construct a bipartite graph where, every family represents a vertex in one partition, and table represents a vertex in another partition. There is a unit capacity edge between a family and a table. There is a source and a destination. The source has an edge to every family, and there is an edge from every table to the destination. Capacity of every source and family j edge equals the size of family j, and the capacity of every table – destination edge is the size of the table. A seating arrangement is possible iff the maximum flow equals the sum of the sizes of the families.

Problem 2 The commander is the source node. Add a destination node with infinite capacity edges from the vertices in S. The minimum effort equals the capacity of the min cut between the source and the destination, which equals the max flow from the source.

Problem 3 Assume that there is no infinite capacity path between the source and the destination. So, the flow in any link is upper bounded by the max flow, which is upper bounded by the sum of the capacities of the finite capacity links. So, the infinite capacities can be replaced by this number.

Problem 4 (1)False C=1, Flow = 1 C=1000, Flow = 100 C=1, Flow =1 C=1000, Flow = 100 (2) True, Given any maxflow allocation subtract min of flow along forward edge, and flow along backward edge, from the flows in both these edges. The flow remains a maxflow, and the flow along the forward or the backward edge is 0.

(3)False C=3 C=2 C=1 C=4 C=30 t s There are 2 mincuts, (a)Edges from the source (b)Edges to the destination (4)False s t C=3 C=2 C=6 Now, the edges from the source constitute the mincut. If 1 is added to the capacity of every link, the edge to the destination constitutes the min cut.

Problem 5 No, every network does not have an upward critical edge. C=1 Every edge in a min-cut is downward critical.

Problem 6 Find an augmenting path in the residual flow graph.

Problem 7 Let a and b be such that f(a)  q, f(b)  q. Need to show that f(  a + (1-  )b)  q. Follows from the fact that f(  a + (1-  )b)   f(a) + (1-  )f(b)  q The first inequality follows from the convexity of f(x). ln  i x i  =  j  j ln x i  ln(  j  j x i ) The last inequality follows from the convexity of –ln x

Problem 8 No, because r can always be increased in this range, without hurting any component (since none other exists). The answer is the same as in the first part. No, as one component can always be increased without hurting a smaller or equal component.

Problem 9 Construct a bipartite graph with faculties and courses representing vertices. There is an edge between two vertices only if one represents a faculty, and the other a course in the preference list of the faculty. Find a maximum matching in the bipartite graph. If the matching matches all the faculty vertices, a feasible allocation exists, otherwise not.

We need to find a feasible allocation where not more than k faculties get there second choices, if one exists. Now, every edge in the previous bipartite graph has a weight. Weight of a first priority edge is 1 +  Weight of a second priority edge is 1  is selected s.t. 0 <  < 1/M (M is the number of faculties) Suppose a feasible allocation exists. Then there is a matching with M edges.

A maximum weighted matching will always have M edges. Let, it have p < M edges. Then its weight is at most p (1 +  ) < p(1 + 1/M) < p + p/M < p + 1  p < M Since there is a matching with M edges, and every edge has weight at least 1, we know that there is a matching with weight at least 1. So, a maximum weighted matching will always choose a feasible allocation. Since it is a maximum weighted matching, it must choose as many first priority edges (weight 1 +  ) as possible, on top of choosing a matching with M edges. Thus it will choose a k-feasible one if it exists.

Problem 10 Assign new weights to all edges. First choose the edges with the highest weight among the old weights. Give them weight 1. Now choose the edges with second highest old weight. New weight of each of these is the sum of the new weights of all edges whose new weights have been assigned. Now choose the third highest ones, and the new weights equal the sum of the previous new weights, etc….

A maximum weighted matching gives absolute priority to the least old weights (because their weights are very high now), subject to that highest priority to the second lowest old weights etc….. So, a max weighted matching gives a lexicographically maximum matching.