Download
what you misses n.
Skip this Video
Loading SlideShow in 5 Seconds..
What you misses! PowerPoint Presentation
Download Presentation
What you misses!

What you misses!

76 Vues Download Presentation
Télécharger la présentation

What you misses!

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. 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.

  2. 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. B A F D C E

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

  4. 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.

  5. 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).

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

  7. Matching Making Service (MaMaServ) a 1 b 2 c 3 d 4 e 5 6

  8. Matching Making Service (MaMaServ) 1 2 3 4 5 6 a 1 a    b 2 b   c 3 c   d d    4 e e     5 6

  9. Matching Making Service f joins in at the last minute a 1 b 2 c 3 d 4 e 5 f 6

  10. Matching Making Service 1 2 3 4 5 6 a 1 a    b 2 b   c 3 c   d 4 d    e 5 e     f  f  6

  11. Matching Making Service 1 2 3 4 5 6 a 1 a    b 2 b   c 3 c   d 4 d    e 5 e     f f   6

  12. Matching Making Service 1 2 3 4 5 6 a 1 a    b 2 b   c 3 c   d 4 d    e 5 e     f f   6

  13. Matching Making Service 1 2 3 4 5 6 a 1 a    b 2 b   c 3 c   d 4 d    e 5 e     f f   6

  14. Matching Making Service 1 2 3 4 5 6 a 1 a    b 2 b   c 3 c   d 4 d    e 5 e     f f   6

  15. Matching Making Service 1 2 3 4 5 6 a 1 a    b 2 b   c 3 c   d 4 d    e 5 e     f f   6

  16. Matching Making Service 1 2 3 4 5 6 a 1 a    b 2 b   c 3 c   d 4 d    e 5 e     f f   6

  17. 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.

  18. Augmenting Path in Bipartite Matching • Given a (partial) matchingM 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.

  19. 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.

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

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

  22. 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.

  23. 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… a 1 b 2 c 3 d 4 e 5 6 f Must have a augmenting path!

  24. Transportation Network 1 3 3 2 2 2 s t 3 3 • Capacity c(e). • Feasible solution • Capacity constraint : 0<= f(e) <= c(e) for each e • Conservation constraint: fin(v) = fout(v) for each v • (except s, t) 1

  25. 1 3 3 2 2 2 s t 3 3 1 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.

  26. 1/1 1/3 1/3 2 2 2 s t 3 3 1 • A backward edge is added in the reversal • to the direction of the flow.

  27. s 10 10 10 x y 10 10 t Cannot increase the flow without decrease the flow in certain edge. .

  28. s 10 10 10 x y 10 10 t Redirection must be considered on existing flows. .

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

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

  31. +

  32. 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.

  33. 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.

  34. 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.

  35. 3 5 5 2 2 1 3 3 6

  36. 3 5 5 2 2 1 3 3 Critical edge 6

  37. 1 3 2 5 2 2 2 1 1 3 4 2 2

  38. 1 3 2 5 2 2 2 1 1 3 4 2 Critical edge 2

  39. 1 3 3 2 2 2 2 2 1 1 1 2 2 2 4

  40. 1 3 3 2 2 2 2 2 1 1 1 2 2 2 4 Critical edge

  41. 1 2 2 2 3 3 1/1 2 1 1 1 2 2 2 4

  42. 1 2 2 2 3 3 1/1 2 1 1 1 2 2 2 4

  43. 3 1 1 4 4 1/1 2 1 1 1 2 2 2 4

  44. 3 1 1 4 4 1/1 2 1 1 1 2 2 2 4

  45. 3 1 1 4 4 1/1 2 1 3 1 3 5

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

  47. s 1000 1000 1 1000 1000 t The worst case? x y s-x-y-t path.

  48. 1000 1000 1 1000 1000

  49. 1000 1000 1 1000 1000