Download Presentation
## Announcements

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -

**Announcements**• Assignment 4: • Due Monday, April 5 at Midnight (due to university regulations). • Submit solutions to any 2 of the 4 problems. • Responsible for understanding all 4 problems (related material may be on final exam). • Tutorial: • Fri, Apr 2 A. Kolokolova 16:00-17:30 PSE 321 • Special office hours (week prior to exam): MWF 2-3**Flow(1)**Residual(1) No more augmenting paths max flow attained. Flow(2) Residual(2) Example**Multiple Sources Network**• We have several sources and several targets. • Want to maximize the total flow from all sources to all targets. • Reduce to max-flow by creating a supersource and a supersink:**Maximum Bipartite Matching**• A bipartite graph is a graph G=(V,E) in which V can be divided into two parts L and R such that every edge in E is between a vertex in L and a vertex in R. • e.g. vertices in L represent skilled workers and vertices in R represent jobs. An edge connects workers to jobs they can perform.**A matching in a graph is a subset M of E, such that for all**vertices v in V, at most one edge of M is incident on v.**A maximummatching is a matching of maximum cardinality.**maximum not maximum**A Maximum Matching**• No matching of cardinality 4, because only one of v and u can be matched. • In the workers-jobs example a max-matching provides work for as many people as possible. v u**Solving the Maximum Bipartite Matching Problem**• Reduce an instance of the maximum bipartite matching problem on graph G to an instance of the max-flow problem on a corresponding flow network G’. • Solve using Ford-Fulkerson method.**Corresponding Flow Network**• To form the corresponding flow network G' of the bipartite graph G: • Add a source vertex s and edges from s to L. • Direct the edges in E from L to R. • Add a target vertex t and edges from R to t. • Assign a capacity of 1 to all edges. • Claim: max-flow in G’ corresponds to a max-bipartite-matching on G.**min cut**Example |M| = 3 max flow = 3**Why can’t we just say max |f| = max |M|?**• Problem: we haven’t shown that f(u,v) is necessarily integer-valued for all (u,v) when f is a max flow. • It follows from the lemma that • max |M| = max [ integral flow], • but we also need • max [integral flow] = max |f|**Integrality Theorem (CLRS 26.11)**• If the capacity function c takes on only integral values, then: • The maximum flow f produced by the Ford-Fulkerson method has the property that |f| is integer-valued. • For all vertices u and v the value f(u,v) of the flow is an integer. • So |M| = max [integral flow] = max |f|**Conclusion**• Network flow algorithms allow us to find the maximum bipartite matching fairly easily. • Similar techniques are applicable in other combinatorial design problems.**Example**• In a department there are n courses and m instructors. • Every instructor has a list of courses he or she can teach. • Every instructor can teach at most 3 courses during a year. • The goal: find an allocation of courses to the instructors subject to these constraints.**Two solutions using network flows**• Solution 1: convert the problem into a bipartite matching problem. • Solution 2: convert the problem into a flow problem directly.**A more complicated problem**• There are m student groups on campus. • We would like to form a committee with a president, 3 vice-pres, and 10 members at large. • The committee is formed by representatives of the groups. • Can add conditions: • The first group can be represented by at most 2 members, any other group can be represented by at most one. • The representative of the third group cannot be the president. • Reduce to network flows!**Computational Complexity Theory**• Computational Complexity Theory is the study of how much of a given resource (such as time, space, parallelism, randomness, algebraic operations, communication, or quantum steps) is required to solve important problems.**WORST-CASE TIME**• We say that a program takes worst-case time T(n), if some input of size n takes T(n) steps, and no input of size n takes longer. • The input size is measured in bits, unless stated otherwise.**K-COLORING**• A k-coloring of a graph is an assignment of one color to each vertex such that: • No more than k colors are used • No two adjacent vertices receive the same color • A graph is called k-colorable iff it has a k-coloring**No: it contains a triangle!**A CRAYOLA Question! • Is Gadget 2-colorable?**A CRAYOLA Question!**• Is Gadget 3-colorable? Yes!**2 CRAYOLAS**• Given a graph G, what is a fast algorithm to decide if it can be 2-colored? PERSPIRATION; BRUTE FORCE: Try out all 2n ways of 2 coloring G.**3 CRAYOLAS**• Given a graph G, what is a fast algorithm to decide if it can be 3-colored? ? ? ? ? ? ? ? ?**K-CLIQUES**• A K-clique is a set of K nodes with all k(K-1)/2 possible edges between them.**Given an n-node graph G and a number k, how can you decide**if G contains a k-clique? • PERSPIRATION: Try out all n choose k possible locations for the k clique • INSPIRATION: ? ? ? ? ? ? ? ?**INDEPENDENT SET**• An independent set is a set of vertices with no edges between them. This graph contains an independent set of size 3.**Given an n-node graph G and a number k, how can you decide**if G contains an independent set of size k? • PERSPIRATION: Try out all n-choose-k possible locations for independent set • INSPIRATION: ? ? ? ? ? ? ? ?**Combinational Circuits**• AND, OR, NOT, gates wired together with no feedback allowed (acyclic).**Logic Gates**Not And Or**CIRCUIT-SATISFIABILITY(decision version)**• Given a circuit with n-inputs and one output, is there a way to assign 0-1 values to the input wires so that the output value is 1 (true)?**CIRCUIT-SATISFIABILITY(search version)**• Given a circuit with n-inputs and one output, find an assignment of 0-1 values to the input wires so that the output value is 1 (true), or determine that no such assignment exists.**Satisfiable?**No!**Given a circuit, is it satisfiable?**• PERSPIRATION: Try out all 2n assignments • INSPIRATION: ? ? ? ? ? ? ? ?**We have seen 4 problems: coloring, clique, independent set,**and circuit SAT. They all have a common story: A large space of possibilities only a tiny fraction of which satisfy the constraints. Brute force takes too long, and no feasible algorithm is known.**CLIQUE / INDEPENDENT SET**• Two problems that are cosmetically different, but substantially the same