Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Graph Theory

Similar presentations


Presentation on theme: "Introduction to Graph Theory"— Presentation transcript:

1 Introduction to Graph Theory
Lecture 07: Bipartite Graphs, Matching and Job Assignments

2 Bipartite Graphs A graph is bipartite if V(G) is partitioned into nonempty subsets V1 and V2, such that if xy is in E(G), x and y belong to different subsets. r1 w1 r2 w2 r3 w3 r4 r5

3 Bipartite Graphs It is common that each subset is give a color.
Can you think of graphs that we have come across are bipartite? Paths, Pn Trees Cn when n is even. The cardinality of the color sets is an invariant of a bipartite graph.

4 Algorithm We want to label V1(G) a and V2(G) b.
Label any vertex a and its neighbors b If there are unlabeled vertices adjacent to labeled vertex v, label them the opposite label that v was assigned. Repeat until no such vertices If there is an unlabeled vertex, go back to step 1 with such a vertex If all adjacent vertices get distinct labels G is bipartite.

5 Shortcut Can we do without the algorithm?
If G contains a cycle with odd number of vertices. Theorem: A graph G is bipartite if and only if G does not contain an odd cycle. Proof?

6 Matchings A matching M is a set of edges, no two of which are incident with one another. What applications can you think of? Seat assignment to ensure harmony Job assignment to maximize efficiency Anything else? r1 w1 r2 w2 r3 r4 w3 r5

7 Matchings in Bipartite Graph
Let G be a bipartite graph with parts X and Y. Complete matching from X to Y: Every vertex in X is incident with an edge of M. (the direction is important, and |X|<|Y|) Perfect matching: M is complete from X to Y and Y to X. (|X|=|Y|) Can you think of an application in which the complete matching is important?

8 Finding Maximum Matching
Maximum matching: M is a maximum matching for G if M has largest cardinality among all possible matchings. Maximal matching: A matching M that cannot be enlarged by adding additional edges, i.e. no larger M’ containing M. The goal here is to find a maximum matching

9 Illustration d d c c e e b b f f a a g g h h (a) Maximal (b) Maximum

10 More Definitions M-alternating path: A path in G whose edges are alternately in M and not in M. A vertex is M-matched if incident to one of the edges of M. Else M-unmatched. M-augmenting path is an alternating path joining two M-unmatched vertices. Need not use all the edges of M Always begin and end with an edge not in M

11 Finding the Maximum Matching
Berge’s Matching Theorem: A matching M in a graph G is maximum if and only if there is no M-augmenting path in G. Proof: “if and only if ” demands the proofs for both directions.

12 Proof (Left -> Right)
Prove by contradiction Suppose that matching M is maximum, and there is an M-augmenting path P. P necessarily has one more edge not in M than in M. Let be edges of P in M, and not in M We construct a new match . Contradiction!

13 Proof (Right -> Left)
Suppose no M-augmenting path, and M is indeed maximum. Assuming M* is maximum => no M*-aug path Let’s construct a graph H containing all V(G), and Analysis of H reveals that So, M is maximum

14 Algorithm For maximum matching in a bipartite graph, we’ll study the algorithm when we discuss networking.

15 Complete vs. Perfect Matching
What properties of a bipartite graph allow as to conclude if a graph is complete or perfect? Having even number of vertices? G is equitable? (parts X and Y have the same number of vertices)

16 Complete Matching in Bipartite Graph
Some notations: n(v) is the set of all vertices adjacent to v. Hall’s Matching Theorem: a bipartite graph G with parts X and Y as a complete matching from X to Y if and only if for every subset

17 Proof: Forward direction
To prove: If a bipartite graph G with parts X and Y as a complete matching from X to Y then for every subset Proof: A complete matching implies each vertex in X is matched to a distinct vertex in Y. Therefore, this condition follows.

18 Proof: Backward direction
To prove: If a bipartite graph G with for every subset then G has a complete matching from X to Y Proof: By contradiction. Suppose no complete matching from X to Y. Let M be the maximum match and is M-unmatched Using the given condition, we know that v has at least one neighbor in Y.

19 Proof: Backward direction (cont)
Proof: By contradiction Case1: if one such neighbor v* is not in Y* (the set of M-matched vertices in Y), then Case2: if every neighbor v* of v is in Y*, we can start and M-alternating path at v that will become M-aug path, since for every This implies that M is not maximum (by Berges’s matching theorem)

20 Perfect Matching in Bipartite Graph
Hall’s Marriage Theorem: a bipartite graph G with parts X and Y, where |X|=|Y|, has a perfect matching if and only if for every subset Proof?

21 Perfect Matching Anther necessary condition for a bipartite graph to be a perfect matching is that it is regular. We start with a lemma Lemma: An r-regular bipartite graph must be equitable. Assume that |X|=k, then |E(G)|=r*k The r*k edges each is incident with a vertex in Y, since G is bipartite And each vertex in Y is incident with r of the r*k edges => r|Y|=r*k Therefore |Y|=k=|X|

22 Perfect Matching Theorem: If a bipartite graph is regular, the it has a perfect matching Proof: We know that G is |X|=|Y|. So, only need to show that G has a complete matching from X to Y We want to show that , for every subset in order to apply Hall’s matching theorem. The technique is similar to the proof for the lemma

23 (cont) Proof: Given any set S of m vertices in X, there is a total of r*m edges, since G is r-reg Each of the r*m edges are also incident to a vertex in Y, since G is bipartite Since each vertex in Y is only incident to r edges, N(S) must contain at least m vertices in Y. Therefore Combining this with Hall’s theorem and the lemma, we complete the proof.

24 Some Remarks M-augmenting path techniques applies to all graphs, not just bipartite graphs. There are other techniques for finding maximum matchings, e.g. the network flow technique. Matchings can be found in weighted graphs too.

25 Quiz Let T be a spanning tree of G. Show that a perfect matching for T is also a perfect matching for G. Find an example to show that the converse is not true.


Download ppt "Introduction to Graph Theory"

Similar presentations


Ads by Google