COMP 2711H: Lecture 20
Date: 2024-10-16 22:28:14
Reviewed:
Topic / Chapter: Stable Matchings and Graph Coloring
summary
❓Questions
Notes
Stable Matchings
-
Problem reduction
- given: bipartite graph
- return: maximum matching
- can we: leverage the fact that the graph is bipartite?
- idea: convert bipartite graph to max flow problem
- let all edge between to be directed
- add a source , connect to all vertex
- add a sink , connect to all vertex
- for all edge: direction is left to right
- all with same capacity
- claim: maximum flow in this new graph, : gives size of maximum matching in
- strategy: prove that two are to each other
- assume: original matching exists in
- then: as no two endpoint overlaps, one can create a flow based on it
- without going over the capacity
- for any matching, there is a flow of same size (= sharing common edges)
- thus max matching <= max flow
- then: as no two endpoint overlaps, one can create a flow based on it
- the other way: a flow exists in
- where unit:
- and consider: only flow / edge in bipartite points
- all edge w/ flow = 1: makes a corresponding matching
- as capacity of all edge: 1, no valid flow can have any conjunction (e.g. )
- max matching >= max flow
- 👨🏫 overall idea: reduction
- algorithm solving one problem: can solve another problem
- regardless of details of algorithm
- we: reduced maximum flow into maximum matching
- 👨🏫 you can somewhat claim: max flow is a harder problem
- algorithm solving one problem: can solve another problem
-
Stable matchings
- e.g. man and women
- want: a perfect 1-to-1 matching
- problem: everyone has preferences
- e.g. every woman : has a preference - permutation of man
- same for man
- all: willing to marry
- suppose: is a perfect matching (all men & women: matched)
- and : not matched together
- pair : unstable if
- prefers over current spouse
- prefers over current spouse
- matching: stable if there are no unstable pairs
- theorem: there is always a stable perfect matching
- typical existence proof in graph: elaborate an algorithm finding solution
- and prove correctness of the algorithm
-
Stable matching algorithm
- algorithm: of several iterations
- for every iteration:
- all man propose to a most preferred woman
- (who has not rejected him so far)
- if: every woman has exactly one proposal they all accept; return
- else: every woman w/ more than one proposal reject all except the most preferred one
- yet: doesn't "accept" the top proposer as well
- maybe tomorrow: she won't get any propose otherwise!
- yet: doesn't "accept" the top proposer as well
- all man propose to a most preferred woman
- algorithm: results in a stable perfect match!
-
Proof of correctness
- algorithm: terminates as
- list of woman a man is willing to propose: shrinks
- total sum on size of all list of woman-to-propose: decreases every time
- yet: it can't go down below 0 ( to be precise)
- background
- from man's PoV: preference is going down
- from woman's PoV: preference is going up (better man might get rejected and come down)
- no. of man not getting rejection: increases
- from man's PoV: preference is going down
- proof by contradiction
- suppose is unstable pair
- prefers over current (e.g. )
- and similarly so
- it's impossible as: should have proposed to before
- yet: it was rejected by
- which means: had a better option at the point
- 's current spouse: must be at least better than the previous optimal option
- which means: had a better option at the point
- yet: it was rejected by
- thus: algorithm always produces stable perfect matching
- suppose is unstable pair
- algorithm: terminates as
Graph Coloring
-
Graph coloring
- given graph : a proper coloring w/ colors: a function
- s.t. for every edge : two endpoints of w/ different color
- definition: doesn't matter whether edge is unidirectional or bidirectional
- chromatic number : minimal number of colors
- needed to properly color
- bipartite graph two-colorable
- independent set: s.t. no edge with both endpoints in
- clique: s.t.
- opposite of IS
- complete subgraph?
- smallest IS/ clique: empty / one-vertex set
- question: can we cover any graph?
- 👨🏫 is the graph is simple - if there is no loop!
- having multiple edge between two nodes: doesn't matter
- let: be size of a largest IS
- let: be size of a largest clique
- given graph : a proper coloring w/ colors: a function
-
Theorems
- theorem:
- somewhat obvious, as:
- there must be colors for largest clique alone
- theorem:
- : size of an largest IS
- proper coloring: w/ groups
- thus
- as each group: at most elements
- then:
- finally: let be chromatic number
- theorem:
- e.g. complete graph
- theorem: suppose : graph w/ maximum degree
- algorithm: greedy coloring
- pick a vertex: color it w/ smallest color possible
- (i.e. not used with its neighbors)
- repeat until all are colored
- doesn't return an optimal color
- pick a vertex: color it w/ smallest color possible
- above algorithm: colors w/ at most
- as : at most neighbors
- and thus (even if its neighbors have all distinct colors):
- can be colored with at most color
- and thus (even if its neighbors have all distinct colors):
- as : at most neighbors
- 👨🏫 no particular better upper bound
- e.g. a triangle / odd cycle: max degree being
- and it requires colors
- same for a complete graph: max degree ,
- e.g. a triangle / odd cycle: max degree being
- exists a theorem: only graphs requiring colors are odd cycles / complete graphs
- finding a better order of coloring
- first: sort vertices w/ degree in non-increasing order
- then: color it the same way as primary school method above
- first: sort vertices w/ degree in non-increasing order
- theorem: let a graph w/ degree seq.
- 👨🏫 many theorems in this area: derived from analysis of algorithm (solution)
- assign color 1
- then assign color 1 if is not its neighbor, 2 otherwise
- on : no. of colored neighbors
- as we colored total of items previously: also
- thus: no. of colored neighbors
- then
- finally, largest color used (not necessarily optimal) is
- theorem:
-
Cartesian product
- suppose : graphs
- Cartesian product of two, aka
- rule: if:
- or:
- simple example: grid
- for following
- suppose : graphs
--- title: G, H --- graph LR 1((1))-->2((2)) 2-->3((3)) a((a))-->b((b))
- then <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathnormal">G</span><span class="mord amsrm">□</span><span class="mord mathnormal" style="margin-right:0.08125em;">H</span></span></span></span>:
graph LR 1a((1,a))-->2a((2,a)) 2a-->3a((3,a)) 1b((1,b))-->2b((2,b)) 2b-->3b((3,b)) 1a-->1b 2a-->2b 3a-->3b
- literally, a grid
-
Theorem
- theorem:
- Cartesian product: cannot have less coloring than operands
- as it's some sort of copy / repeat
- suppose:
- and
-
- example
- and this is a proper coloring in general, as in either case of the rule:
- or:
- we are assigning a new color
- case 1:
- and there is an edge , thus
- as sum are different (and ), is different, too
- case 2: can be done similarly
- instead of
- finally: it's a valid coloring
- Cartesian product: cannot have less coloring than operands
- theorem: