Advanced Algorithms
Part 1. Matroids & Greedy Algorithms
Part 1a. Motivation & Definition
Part 1b. Demonstrating that Greedy Works
Part 1c. Scheduling with Deadlines
Part 1d. Matroid Intersection and Examples
Part 1e. The Matroid Intersection Algorithm
Advanced Algorithms
Part 1. Matroids & Greedy Algorithms
Part 1a. Motivation & Definition
Part 1b. Demonstrating that Greedy Works
Part 1c. Scheduling with Deadlines
Part 1d. Matroid Intersection and Examples
Part 1e. The Matroid Intersection Algorithm
A Generic Optimization Problem
Suppose we have:
a finite universe of elements \(\cal U = \{e_1, e_2, \cdots, e_n\}\)
a weight function \(w: \cal U \longrightarrow \mathbb{Q}^{\geqslant 0}\),
that assigns a non-negative weight to every universe element
a family \(\cal F = \{S_1, \ldots, S_m\}\) of subsets of \(\cal U\)
...and we lift \(w\) to the sets in \(\cal F\) as follows:
\(w(S) = \sum_{e \in S} w(e).\)
What is the maximum weight attained by a set in \(\cal F\)?
A Generic Optimization Problem
Suppose we have:
a finite universe of elements \(\cal U = \{e_1, e_2, \cdots, e_n\}\)
a weight function \(w: \cal U \longrightarrow \mathbb{Q}^{\geqslant 0}\),
that assigns a non-negative weight to every universe element
a family \(\cal F = \{S_1, \ldots, S_m\}\) of subsets of \(\cal U\)
...and we lift \(w\) to the sets in \(\cal F\) as follows:
\(w(S) = \sum_{e \in S} w(e).\)
What is the maximum weight attained by a set in \(\cal F\)?
\({\cal U} := E(G)\)
edge weights
acyclic subsets of edges
MST
A Generic Optimization Problem
Is this a set of the largest cardinality?
\({\cal U} := \{e_1,\ldots,e_n\}, w: {\cal U} \rightarrow \mathrm{Q}^{\geqslant 0}, {\cal F} \in 2^{{\cal U}}\).
What is the maximum weight attained by a set in \(\cal F\)?
What is a trivial algorithm?
What is the cost of the trivial approach?
What is a natural greedy algorithm?
not necessarily
enumeration
exp in \(n\), poly in input size
keep picking heavy elements
Does the greedy algorithm work?
not necessarily
the family is implicitly specified
\(S \subseteq_{?} {\cal U}\)
yes/no
The Greedy Algorithm
\({\cal U} := \{e_1,\ldots,e_n\}, w: {\cal U} \rightarrow \mathrm{Q}^{\geqslant 0}, {\cal F} \in 2^{{\cal U}}\).
What is the maximum weight attained by a set in \(\cal F\)?
(the family is implicitly specified)
Sort the elements of \(U\) in descending order of weight;
i.e, \({\color{seagreen}w(e_1) \geqslant \cdots \geqslant w(e_n)}\).
Initialize a solution: specifically, let \(X = \emptyset\).
For \(i \in [n]\):
if \({\color{indianred}X \cup \{e_i\} \in \cal F}\):
\(X \longleftarrow X \cup \{e_i\}\).
not necessarily
Does the greedy algorithm work?
The Greedy Algorithm
\({\cal U} := \{e_1,\ldots,e_n\}, w: {\cal U} \rightarrow \mathrm{Q}^{\geqslant 0}, {\cal F} \in 2^{{\cal U}}\).
What is the maximum weight attained by a set in \(\cal F\)?
(the family is implicitly specified)
Let:
- \(\cal U = \{p,q,r\}\)
- \(w(p) = 40, w(q) = 30, w(r) = 20\)
- \(\cal F = \{\{p\},\{qr\}\}\)
not necessarily
Does the greedy algorithm work?
Greedy?
OPT?
40
50
The Greedy Algorithm
\({\cal U} := \{e_1,\ldots,e_n\}, w: {\cal U} \rightarrow \mathrm{Q}^{\geqslant 0}, {\cal F} \in 2^{{\cal U}}\).
What is the maximum weight attained by a set in \(\cal F\)?
(the family is implicitly specified)
Then wt(OPT) > wt(GREEDY) because
there is a \(g_{k+1}\).
What if, for all \(1 \leqslant i \leqslant k\), \(g_i = f_i\)?
\(f_1\)
\(f_2\)
\(f_j\)
\(g_1\)
\(g_2\)
\(g_\ell\)
\(\cdots\)
\(\cdots\)
\(\cdots\)
\(\cdots\)
\(f_i\)
\(g_i\)
\(g_j\)
\(\cdots\)
\(f_k\)
\(\cdots\)
heaviest
lightest
The Greedy Algorithm
\({\cal U} := \{e_1,\ldots,e_n\}, w: {\cal U} \rightarrow \mathrm{Q}^{\geqslant 0}, {\cal F} \in 2^{{\cal U}}\).
What is the maximum weight attained by a set in \(\cal F\)?
(the family is implicitly specified)
By GREEDY: \(w(f_i) \geqslant w(g_i)\).
\(f_1\)
\(f_2\)
\(f_j\)
\(g_1\)
\(g_2\)
\(g_\ell\)
So there exists \(1 \leqslant i \leqslant k\), \(g_i \neq f_i\).
\(\cdots\)
\(\cdots\)
\(\cdots\)
\(\cdots\)
\(f_i\)
\(g_i\)
\(g_j\)
\(\cdots\)
\(f_k\)
\(\cdots\)
So there also exists \(j > i\) where \(w(g_j) > w(f_j)\).
heaviest
lightest
The Greedy Algorithm
\({\cal U} := \{e_1,\ldots,e_n\}, w: {\cal U} \rightarrow \mathrm{Q}^{\geqslant 0}, {\cal F} \in 2^{{\cal U}}\).
What is the maximum weight attained by a set in \(\cal F\)?
(the family is implicitly specified)
\(f_1\)
\(f_2\)
\(f_j\)
\(g_1\)
\(g_2\)
\(g_\ell\)
So there exists \(1 \leqslant i \leqslant k\), \(g_i \neq f_i\).
\(\cdots\)
\(\cdots\)
\(\cdots\)
\(\cdots\)
\(f_i\)
\(g_i\)
\(g_j\)
\(\cdots\)
\(f_k\)
\(\cdots\)
Why did the greedy algorithm not pick \(g_j\)?
So there also exists \(j > i\) where \(w(g_j) > w(f_j)\).
heaviest
lightest
The Greedy Algorithm
\({\cal U} := \{e_1,\ldots,e_n\}, w: {\cal U} \rightarrow \mathrm{Q}^{\geqslant 0}, {\cal F} \in 2^{{\cal U}}\).
What is the maximum weight attained by a set in \(\cal F\)?
(the family is implicitly specified)
\(f_1\)
\(f_2\)
\(f_j\)
\(g_1\)
\(g_2\)
\(g_\ell\)
So there exists \(1 \leqslant i \leqslant k\), \(g_i \neq f_i\).
\(\cdots\)
\(\cdots\)
\(\cdots\)
\(\cdots\)
\(f_i\)
\(g_i\)
\(g_j\)
\(\cdots\)
\(f_k\)
\(\cdots\)
The element was incompatible with the choices we already made!
So there also exists \(j > i\) where \(w(g_j) > w(f_j)\).
heaviest
lightest
The Greedy Algorithm
\({\cal U} := \{e_1,\ldots,e_n\}, w: {\cal U} \rightarrow \mathrm{Q}^{\geqslant 0}, {\cal F} \in 2^{{\cal U}}\).
What is the maximum weight attained by a set in \(\cal F\)?
(the family is implicitly specified)
The Greedy Algorithm
\({\cal U} := \{e_1,\ldots,e_n\}, w: {\cal U} \rightarrow \mathrm{Q}^{\geqslant 0}, {\cal F} \in 2^{{\cal U}}\).
What is the maximum weight attained by a set in \(\cal F\)?
(the family is implicitly specified)
👀
The Greedy Algorithm
\({\cal U} := \{e_1,\ldots,e_n\}, w: {\cal U} \rightarrow \mathrm{Q}^{\geqslant 0}, {\cal F} \in 2^{{\cal U}}\).
What is the maximum weight attained by a set in \(\cal F\)?
(the family is implicitly specified)
👀
The Greedy Algorithm
\({\cal U} := \{e_1,\ldots,e_n\}, w: {\cal U} \rightarrow \mathrm{Q}^{\geqslant 0}, {\cal F} \in 2^{{\cal U}}\).
What is the maximum weight attained by a set in \(\cal F\)?
(the family is implicitly specified)
👀
The Greedy Algorithm
\({\cal U} := \{e_1,\ldots,e_n\}, w: {\cal U} \rightarrow \mathrm{Q}^{\geqslant 0}, {\cal F} \in 2^{{\cal U}}\).
What is the maximum weight attained by a set in \(\cal F\)?
(the family is implicitly specified)
\(\exists e \in S \setminus T\) such that \(T \cup \{e\} \in \cal F\)
\(S\)
\(T\)
if \(|S|>|T|\),
Matroids
A matroid \((\cal U, \cal F)\) consists of a finite ground set \(\cal U\)
and a collection \(\mathcal{F}\) of subsets of \(\cal U\) that satisfies:
Non-emptiness. The empty set is in \(\mathcal{F}\).
(Thus, \(\mathcal{F}\) is not itself empty.)
Heredity. If \(\mathcal{F}\) contains a subset \(S \subseteq \cal U\),
then \(\mathcal{F}\) contains every subset of \(S\).
Exchange. If \(S\) and \(T\) are two sets in \(\cal F\) where \(|S|>|T|\),
then \(T \cup\{e\} \in \mathcal{F}\) for some element \(e \in S \backslash T\).
Matroids
Independent Sets. The elements of \(\mathcal{F}\) are called independent sets.
Basis. A maximal independent set is a basis.
Note: All maximal sets of a matroid \(\cal F\) have the same size.
Rank. The common size of the maximal sets is the rank of a matroid.
Dependent Sets. Subsets of \(\mathcal{U}\) not in \({\cal F}\) are called dependent sets.
Circuit. A minimal dependent set is called a circuit.
Examples of Matroids
Uniform matroid \(U_{k, n}\).
A subset \(X \subseteq\{1,2, \ldots, n\}\) is independent if and only if \(|X| \leq k\).
Any subset of \(\{1,2, \ldots, n\}\) of size \(k\) is a basis;
any subset of size \(k+1\) is a circuit.
Examples of Matroids
Graphic/cycle matroid \(\mathcal{M}(G)\).
Let \(G=(V, E)\) be an arbitrary undirected graph.
A subset of \(E\) is independent if it defines an acyclic subgraph of \(G\).
A basis in the graphic matroid is a spanning tree of \(G\);
a circuit in this matroid is a cycle in \(G\).
Examples of Matroids
Cographic/cocycle matroid \(\mathcal{M}^*(G)\).
Let \(G=(V, E)\) be an arbitrary undirected graph.
A subset \(I \subseteq E\) is independent if the complementary subgraph \((V, E \backslash I)\) of \(G\) is connected.
A basis in this matroid is the complement of a spanning tree;
a circuit in this matroid is a cocycle:
a minimal set of edges that disconnects the graph.
A non-example
Not the Matching Matroid
Let \(G=(V, E)\) be an arbitrary undirected graph.
A subset \(I \subseteq E\) is independent if the edges are disjoint.
Representing Matroids
A Linear Matroid
Let \({\cal U}\) be a set, and assign to every \(e \in {\cal U}\) a vector \(v_e\) over some field.
The vectors for the different elements of the universe should all be over the same field \(F\) and have the same dimension.
A set \(S \subseteq {\cal U}\) is in \(\mathcal{F}\)
if and only if
the set \(\left\{v_e: e \in S\right\}\) forms a linearly independent set of vectors.
\(({\cal U},\mathcal{F})\) is a matroid.
Advanced Algorithms
Part 1. Matroids & Greedy Algorithms
Part 1a. Motivation & Definition
Part 1b. Demonstrating that Greedy Works
Part 1c. Scheduling with Deadlines
Part 1d. Matroid Intersection and Examples
Part 1e. The Matroid Intersection Algorithm
The Greedy Algorithm when \({\cal U},{\cal F}\) is a matroid
\({\cal U} := \{e_1,\ldots,e_n\}, w: {\cal U} \rightarrow \mathrm{Q}^{\geqslant 0}, {\cal F} \in 2^{{\cal U}}\).
What is the maximum weight attained by a set in \(\cal F\)?
(the family is implicitly specified)
Greedy Output · WLOG \(\{f_1,\ldots,f_k\}\) form a basis.
\(f_1\)
\(f_2\)
\(f_j\)
\(g_1\)
\(g_2\)
\(g_\ell\)
\(\cdots\)
\(\cdots\)
\(\cdots\)
\(\cdots\)
\(f_i\)
\(g_i\)
\(g_j\)
\(\cdots\)
\(f_k\)
\(\cdots\)
heaviest
lightest
OPT Output · WLOG \(\{g_1,\ldots,g_\ell\}\) form a basis.
The Greedy Algorithm when \({\cal U},{\cal F}\) is a matroid
\({\cal U} := \{e_1,\ldots,e_n\}, w: {\cal U} \rightarrow \mathrm{Q}^{\geqslant 0}, {\cal F} \in 2^{{\cal U}}\).
What is the maximum weight attained by a set in \(\cal F\)?
(the family is implicitly specified)
Greedy Output · WLOG \(\{f_1,\ldots,f_k\}\) form a basis.
\(f_1\)
\(f_2\)
\(g_1\)
\(g_2\)
\(g_k\)
\(\cdots\)
\(\cdots\)
\(f_k\)
heaviest
lightest
OPT Output · WLOG \(\{g_1,\ldots,g_\ell\}\) form a basis.
\(f_i\)
\(f_{i-1}\)
\(g_{i-1}\)
\(g_i\)
\(\cdots\)
\(\cdots\)
The Greedy Algorithm when \({\cal U},{\cal F}\) is a matroid
\({\cal U} := \{e_1,\ldots,e_n\}, w: {\cal U} \rightarrow \mathrm{Q}^{\geqslant 0}, {\cal F} \in 2^{{\cal U}}\).
What is the maximum weight attained by a set in \(\cal F\)?
(the family is implicitly specified)
Suppose, for the sake of contradiction:
\(\sum_{i=1}^k w\left(f_i\right)<\sum_{j=1}^{\ell} w\left(g_i\right).\)
\(f_1\)
\(f_2\)
\(g_1\)
\(g_2\)
\(g_k\)
\(\cdots\)
\(\cdots\)
\(f_k\)
heaviest
lightest
\(f_i\)
\(f_{i-1}\)
\(g_{i-1}\)
\(g_i\)
\(\cdots\)
\(\cdots\)
The Greedy Algorithm when \({\cal U},{\cal F}\) is a matroid
\({\cal U} := \{e_1,\ldots,e_n\}, w: {\cal U} \rightarrow \mathrm{Q}^{\geqslant 0}, {\cal F} \in 2^{{\cal U}}\).
What is the maximum weight attained by a set in \(\cal F\)?
(the family is implicitly specified)
Let \(i\) be the smallest index such that \(w\left(f_i\right)<w\left(g_i\right)\).
\(f_1\)
\(f_2\)
\(f_i\)
\(g_1\)
\(g_2\)
\(g_k\)
\(\cdots\)
\(\cdots\)
\(f_{i-1}\)
\(g_{i-1}\)
\(g_i\)
\(\cdots\)
\(f_k\)
\(\cdots\)
heaviest
lightest
The Greedy Algorithm when \({\cal U},{\cal F}\) is a matroid
\({\cal U} := \{e_1,\ldots,e_n\}, w: {\cal U} \rightarrow \mathrm{Q}^{\geqslant 0}, {\cal F} \in 2^{{\cal U}}\).
What is the maximum weight attained by a set in \(\cal F\)?
(the family is implicitly specified)
Let \(i\) be the smallest index such that \(w\left(f_i\right)<w\left(g_i\right)\).
\(f_1\)
\(f_2\)
\(f_i\)
\(g_1\)
\(g_2\)
\(g_k\)
\(\cdots\)
\(\cdots\)
\(f_{i-1}\)
\(g_{i-1}\)
\(g_i\)
\(\cdots\)
\(f_k\)
\(\cdots\)
heaviest
lightest
Consider the highlighted independent sets.
The Greedy Algorithm when \({\cal U},{\cal F}\) is a matroid
\({\cal U} := \{e_1,\ldots,e_n\}, w: {\cal U} \rightarrow \mathrm{Q}^{\geqslant 0}, {\cal F} \in 2^{{\cal U}}\).
What is the maximum weight attained by a set in \(\cal F\)?
(the family is implicitly specified)
Let \(i\) be the smallest index such that \(w\left(f_i\right)<w\left(g_i\right)\).
\(f_1\)
\(f_2\)
\(f_i\)
\(g_1\)
\(g_2\)
\(g_k\)
\(\cdots\)
\(\cdots\)
\(f_{i-1}\)
\(g_{i-1}\)
\(g_i\)
\(\cdots\)
\(f_k\)
\(\cdots\)
heaviest
lightest
Consider the highlighted independent sets.
The Greedy Algorithm when \({\cal U},{\cal F}\) is a matroid
\({\cal U} := \{e_1,\ldots,e_n\}, w: {\cal U} \rightarrow \mathrm{Q}^{\geqslant 0}, {\cal F} \in 2^{{\cal U}}\).
What is the maximum weight attained by a set in \(\cal F\)?
(the family is implicitly specified)
Let \(i\) be the smallest index such that \(w\left(f_i\right)<w\left(g_i\right)\).
\(f_1\)
\(f_2\)
\(f_i\)
\(g_1\)
\(g_2\)
\(g_k\)
\(\cdots\)
\(\cdots\)
\(f_{i-1}\)
\(g_{i-1}\)
\(g_i\)
\(\cdots\)
\(f_k\)
\(\cdots\)
heaviest
lightest
Apply the exchange property to counter the greedy choice.
The Greedy Algorithm when \({\cal U},{\cal F}\) is a matroid
\({\cal U} := \{e_1,\ldots,e_n\}, w: {\cal U} \rightarrow \mathrm{Q}^{\geqslant 0}, {\cal F} \in 2^{{\cal U}}\).
What is the maximum weight attained by a set in \(\cal F\)?
(the family is implicitly specified)
Lemma. For any heriditary family \((\mathcal{U}, \mathcal{F})\) that is not a matroid,
there is a weight function \(w\) such that
the greedy algorithm fails to output the optimal answer.
\(\exists S, T \in \mathcal{F}\) such that \(|S|>|T|\)
but for all \(e \in S \backslash T, T \cup\{e\} \notin \mathcal{F}\).
Using \(m\) to denote \(|T|\):
- Every element of \(T\) has weight \(m+2\).
- Every element of \(S \backslash T\) has weight \(m+1\).
- Every other element of the ground set has weight zero.
Greedy?
OPT?
\(\leqslant m(m+2)\)
\(\geqslant (m+1)^2\)
Advanced Algorithms
Part 1. Matroids & Greedy Algorithms
Part 1a. Motivation & Definition
Part 1b. Demonstrating that Greedy Works
Part 1c. Scheduling with Deadlines
Part 1d. Matroid Intersection and Examples
Part 1e. The Matroid Intersection Algorithm
Scheduling with Deadlines
Suppose you have \(n\) tasks to complete in \(n\) days; each task requires your attention for a full day.
Each task comes with a deadline,
the last day by which the job should be completed,
and a penalty that you must pay
if you do not complete each task by its assigned deadline.
What order should you perform your tasks in to minimize the total penalty you must pay?
Scheduling with Deadlines
Suppose you have \(n\) tasks to complete in \(n\) days; each task requires your attention for a full day.
\(D[1, \ldots, n]\),
where each \(D[i]\) is an integer between \(1\) and \(n\).
and a penalty that you must pay
if you do not complete each task by its assigned deadline.
What order should you perform your tasks in to minimize the total penalty you must pay?
Scheduling with Deadlines
Suppose you have \(n\) tasks to complete in \(n\) days; each task requires your attention for a full day.
\(D[1, \ldots, n]\),
where each \(D[i]\) is an integer between \(1\) and \(n\).
\(P[1,\ldots,n]\),
where each \(P[j]\) is a non-negative real number.
What order should you perform your tasks in to minimize the total penalty you must pay?
Scheduling with Deadlines
Suppose you have \(n\) tasks to complete in \(n\) days; each task requires your attention for a full day.
\(D[1, \ldots, n]\),
where each \(D[i]\) is an integer between \(1\) and \(n\).
\(P[1,\ldots,n]\),
where each \(P[j]\) is a non-negative real number.
Find a permutation that minimizes:
\(\operatorname{cost}(\pi):=\sum_{i=1}^n P[i] \cdot[\pi(i)>D[i]].\)
Scheduling with Deadlines
For any schedule \(\pi\), call tasks \(i\) such that \(\pi(i)>D[i]\) late or delayed, and all other tasks on time.
Let \(S \subseteq\) \([n]\) be some subset of tasks.
Suppose we have a schedule \(\pi_1\) that delays all tasks in \(S\) and finishes all tasks that are not in \(S\) on time,
and another schedule \(\pi_2 \neq \pi_1\) that also delays all tasks in \(S\) and
finishes all tasks that are not in \(S\) on time.
What can we say about the costs of these schedules?
Scheduling with Deadlines
For any schedule \(\pi\), call tasks \(i\) such that \(\pi(i)>D[i]\) late or delayed, and all other tasks on time.
Let \(S \subseteq\) \([n]\) be some subset of tasks.
Suppose we have a schedule \(\pi_1\) that delays all tasks in \(S\) and finishes all tasks that are not in \(S\) on time,
and another schedule \(\pi_2 \neq \pi_1\) that also delays all tasks in \(S\) and
finishes all tasks that are not in \(S\) on time.
\(\operatorname{cost}\left(\pi_1\right)=\) \(\operatorname{cost}\left(\pi_2\right)\).
Scheduling with Deadlines
Call a subset \(X\) of the tasks realistic if there is a schedule \(\pi\) in which every task in \(X\) is on time.
Let \(X(t)\) denote the subset of tasks in \(X\) whose deadline is on or before \(t\):
\(X(t):=\{i \in X \mid D[i] \leqslant t\}\)
For \(X\) to be realistic, what can we say about \(X(t)\)?
Clearly, \(|X(t)| \leqslant t\).
Scheduling with Deadlines
Call a subset \(X\) of the tasks realistic if there is a schedule \(\pi\) in which every task in \(X\) is on time.
Let \(X(t)\) denote the subset of tasks in \(X\) whose deadline is on or before \(t\):
\(X(t):=\{i \in X \mid D[i] \leqslant t\}\)
Suppose \(|X(t)| \leqslant t\) for all days \(t\). What can we say about \(X\)?
\(X\) is realistic. (How?)
Scheduling with Deadlines
Call a subset \(X\) of the tasks realistic if there is a schedule \(\pi\) in which every task in \(X\) is on time.
Let \(X(t)\) denote the subset of tasks in \(X\) whose deadline is on or before \(t\):
\(X(t):=\{i \in X \mid D[i] \leqslant t\}\)
Suppose \(|X(t)| \leqslant t\) for all days \(t\). What can we say about \(X\)?
\(X\) is realistic. (How?)
Find a realistic subset \(X\) such that \(\sum_{i \in X} P[i]\) is ...
Scheduling with Deadlines
Call a subset \(X\) of the tasks realistic if there is a schedule \(\pi\) in which every task in \(X\) is on time.
Let \(X(t)\) denote the subset of tasks in \(X\) whose deadline is on or before \(t\):
\(X(t):=\{i \in X \mid D[i] \leqslant t\}\)
Suppose \(|X(t)| \leqslant t\) for all days \(t\). What can we say about \(X\)?
\(X\) is realistic. (How?)
Find a realistic subset \(X\) such that \(\sum_{i \in X} P[i]\) is maximized.
Scheduling with Deadlines
Lemma. The collection of realistic sets of jobs forms a matroid.
Proof. The empty set is vacuously realistic.
Any subset of a realistic set is clearly realistic.
It suffices to show that the exchange property holds.
Let \({\color{IndianRed}X}\) and \({\color{DodgerBlue}Y}\) be realistic sets of jobs with \(|{\color{IndianRed}X}|>|{\color{DodgerBlue}Y}|\).
DAY
\(X(t)\)
\(Y(t)\)
DAY
0
0
0
0
Scheduling with Deadlines
Lemma. The collection of realistic sets of jobs forms a matroid.
Proof. The empty set is vacuously realistic.
Any subset of a realistic set is clearly realistic.
It suffices to show that the exchange property holds.
Let \({\color{IndianRed}X}\) and \({\color{DodgerBlue}Y}\) be realistic sets of jobs with \(|{\color{IndianRed}X}|>|{\color{DodgerBlue}Y}|\).
DAY
\(X(t)\)
\(Y(t)\)
DAY
1
1
1
1
Scheduling with Deadlines
Lemma. The collection of realistic sets of jobs forms a matroid.
Proof. The empty set is vacuously realistic.
Any subset of a realistic set is clearly realistic.
It suffices to show that the exchange property holds.
Let \({\color{IndianRed}X}\) and \({\color{DodgerBlue}Y}\) be realistic sets of jobs with \(|{\color{IndianRed}X}|>|{\color{DodgerBlue}Y}|\).
DAY
\(X(t)\)
\(Y(t)\)
DAY
2
2
2
2
Scheduling with Deadlines
Lemma. The collection of realistic sets of jobs forms a matroid.
Proof. The empty set is vacuously realistic.
Any subset of a realistic set is clearly realistic.
It suffices to show that the exchange property holds.
Let \({\color{IndianRed}X}\) and \({\color{DodgerBlue}Y}\) be realistic sets of jobs with \(|{\color{IndianRed}X}|>|{\color{DodgerBlue}Y}|\).
DAY
\(X(t)\)
\(Y(t)\)
DAY
3
3
3
3
Scheduling with Deadlines
Lemma. The collection of realistic sets of jobs forms a matroid.
Proof. The empty set is vacuously realistic.
Any subset of a realistic set is clearly realistic.
It suffices to show that the exchange property holds.
Let \({\color{IndianRed}X}\) and \({\color{DodgerBlue}Y}\) be realistic sets of jobs with \(|{\color{IndianRed}X}|>|{\color{DodgerBlue}Y}|\).
DAY
\(X(t)\)
\(Y(t)\)
DAY
4
4
3
3
Scheduling with Deadlines
Lemma. The collection of realistic sets of jobs forms a matroid.
Proof. The empty set is vacuously realistic.
Any subset of a realistic set is clearly realistic.
It suffices to show that the exchange property holds.
Let \({\color{IndianRed}X}\) and \({\color{DodgerBlue}Y}\) be realistic sets of jobs with \(|{\color{IndianRed}X}|>|{\color{DodgerBlue}Y}|\).
DAY
\(X(t)\)
\(Y(t)\)
DAY
5
5
3
3
Scheduling with Deadlines
Lemma. The collection of realistic sets of jobs forms a matroid.
Proof. The empty set is vacuously realistic.
Any subset of a realistic set is clearly realistic.
It suffices to show that the exchange property holds.
Let \({\color{IndianRed}X}\) and \({\color{DodgerBlue}Y}\) be realistic sets of jobs with \(|{\color{IndianRed}X}|>|{\color{DodgerBlue}Y}|\).
DAY
\(X(t)\)
\(Y(t)\)
DAY
6
6
5
5
Scheduling with Deadlines
Lemma. The collection of realistic sets of jobs forms a matroid.
Proof. The empty set is vacuously realistic.
Any subset of a realistic set is clearly realistic.
It suffices to show that the exchange property holds.
Let \({\color{IndianRed}X}\) and \({\color{DodgerBlue}Y}\) be realistic sets of jobs with \(|{\color{IndianRed}X}|>|{\color{DodgerBlue}Y}|\).
DAY
\(X(t)\)
\(Y(t)\)
DAY
7
7
7
6
Scheduling with Deadlines
Lemma. The collection of realistic sets of jobs forms a matroid.
Proof. The empty set is vacuously realistic.
Any subset of a realistic set is clearly realistic.
It suffices to show that the exchange property holds.
Let \({\color{IndianRed}X}\) and \({\color{DodgerBlue}Y}\) be realistic sets of jobs with \(|{\color{IndianRed}X}|>|{\color{DodgerBlue}Y}|\).
DAY
\(X(t)\)
\(Y(t)\)
DAY
7
7
7
6
Scheduling with Deadlines
Exercise. Figure out an efficient implementation of
oracle access to the family of realistic sets.
Advanced Algorithms
Part 1. Matroids & Greedy Algorithms
Part 1a. Motivation & Definition
Part 1b. Demonstrating that Greedy Works
Part 1c. Scheduling with Deadlines
Part 1d. Matroid Intersection and Examples
Part 1e. The Matroid Intersection Algorithm
Bipartite Matching
Bipartite Matching
3
1
2
Bipartite Matching
3
1
2
Bipartite Matching
3
1
2
Greedy = 5
Bipartite Matching
3
1
2
OPT = 6
Bipartite Matching
3
1
2
OPT = 6
Bipartite Matching
Let \({\cal U} := E(G)\) and let:
\({\cal F}_{\color{IndianRed} L} := \{S \subseteq {\cal U} \mid \forall v \in {\color{IndianRed} L}, |S \cap \delta(v)| \leqslant 1\}\);
\({\cal F}_{\color{DodgerBlue} R} := \{S \subseteq {\cal U} \mid \forall v \in {\color{DodgerBlue} R}, |S \cap \delta(v)| \leqslant 1\}\),
where \(\delta(v)\) denotes the set of edges
incident on the vertex \(v\).
Bipartite Matching
Let \({\cal U} := E(G)\) and let:
\({\cal F}_{\color{IndianRed} L} := \{S \subseteq {\cal U} \mid \forall v \in {\color{IndianRed} L}, |S \cap \delta(v)| \leqslant 1\}\);
\({\cal F}_{\color{DodgerBlue} R} := \{S \subseteq {\cal U} \mid \forall v \in {\color{DodgerBlue} R}, |S \cap \delta(v)| \leqslant 1\}\),
where \(\delta(v)\) denotes the set of edges
incident on the vertex \(v\).
This subset does not belong to \({\cal F}_{{\color{IndianRed}L}}\),
but does belong to \({\cal F}_{{\color{DodgerBlue}R}}\).
Bipartite Matching
Let \({\cal U} := E(G)\) and let:
\({\cal F}_{\color{IndianRed} L} := \{S \subseteq {\cal U} \mid \forall v \in {\color{IndianRed} L}, |S \cap \delta(v)| \leqslant 1\}\);
\({\cal F}_{\color{DodgerBlue} R} := \{S \subseteq {\cal U} \mid \forall v \in {\color{DodgerBlue} R}, |S \cap \delta(v)| \leqslant 1\}\),
where \(\delta(v)\) denotes the set of edges
incident on the vertex \(v\).
Exercise: Show that \({\cal F}_{{\color{IndianRed}L}}\) and \({\cal F}_{{\color{DodgerBlue}R}}\) are matroids.
Bipartite Matching
Let \({\cal U} := E(G)\) and let:
\({\cal F}_{\color{IndianRed} L} := \{S \subseteq {\cal U} \mid \forall v \in {\color{IndianRed} L}, |S \cap \delta(v)| \leqslant 1\}\);
\({\cal F}_{\color{DodgerBlue} R} := \{S \subseteq {\cal U} \mid \forall v \in {\color{DodgerBlue} R}, |S \cap \delta(v)| \leqslant 1\}\),
where \(\delta(v)\) denotes the set of edges
incident on the vertex \(v\).
What can you say about the sets that belong to both \({\cal F}_{{\color{IndianRed}L}}\) and \({\cal F}_{{\color{DodgerBlue}R}}\)?
... the set of all matchings in this graph.
Input:
- a universe \(U\),
- \(\ell\) matrices representing matroids \(\mathcal{M}_1, \mathcal{M}_2, \ldots \mathcal{M}_{\ell}\) over \(U\),
- an integer \(k\).
\(\ell\)-MATROID INTERSECTION
Task:
Determine whether there exists a set \(S \subseteq U\) of size at least \(k\) that is independent in all of the matroids \(\mathcal{M}_i, i \leqslant \ell\).
Matroid Intersection
Given two matroids \(({\cal U},{\cal F}_1),({\cal U},{\cal F}_2)\).
Task: find a maximum-size subset that is independent in both matroids.
For two set systems \(\mathcal{S}_1=\left(U, \mathcal{F}_1\right)\) and \(\mathcal{S}_2=\left(U, \mathcal{F}_2\right)\), we define their intersection as:
\(\mathcal{S}_1 \cap \mathcal{S}_2=\left(U, \mathcal{F}_1 \cap \mathcal{F}_2\right).\)
Matroid Intersection
At some point, we get stuck, and our answer is not necessarily optimal yet.
Initialize \(S := \emptyset\).
While there exists \(e \in {\cal U}\) such that
\(S \cup \{e\}\) is independent in both \({\cal F}_1\) and \({\cal F}_2\),
then update \(S \longleftarrow S \cup \{e\}\).
A Greedy Approach
At some point, we get stuck,
and our answer is not necessarily optimal yet.
Initialize \(S := \emptyset\).
While there exists \(e \in {\cal U}\) such that
\(S \cup \{e\}\) is independent in both \({\cal F}_1\) and \({\cal F}_2\),
then update \(S \longleftarrow S \cup \{e\}\).
\(u\)
\(v\)
\(y\)
\(x\)
Add the edge \({\color{IndianRed}u} \rightarrow {\color{DodgerBlue}v}\) if adding \(v\) and removing \(u\) from \(A\) gives us a set that is independent in \({\cal F}_1\).
Add the edge \({\color{DodgerBlue}x} \rightarrow {\color{IndianRed}y}\) if adding \(x\) and removing \(y\) from \(A\) gives us a set that is independent in \({\cal F}_2\).
\(A\)
\(B\)
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
At some point, we get stuck,
and our answer is not necessarily optimal yet.
Initialize \(S := \emptyset\).
While there exists \(e \in {\cal U}\) such that
\(S \cup \{e\}\) is independent in both \({\cal F}_1\) and \({\cal F}_2\),
then update \(S \longleftarrow S \cup \{e\}\).
\(u\)
\(v\)
\(y\)
\(x\)
\(A\)
\(B\)
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
Add the edge \({\color{IndianRed}u} \rightarrow {\color{DodgerBlue}v}\) if adding \(v\) and removing \(u\) from \(A\) gives us a set that is independent in \({\cal F}_1\).
Add the edge \({\color{DodgerBlue}x} \rightarrow {\color{IndianRed}y}\) if adding \(x\) and removing \(y\) from \(A\) gives us a set that is independent in \({\cal F}_2\).
At some point, we get stuck,
and our answer is not necessarily optimal yet.
Initialize \(S := \emptyset\).
While there exists \(e \in {\cal U}\) such that
\(S \cup \{e\}\) is independent in both \({\cal F}_1\) and \({\cal F}_2\),
then update \(S \longleftarrow S \cup \{e\}\).
\(v\)
\(A\)
\(B\)
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
Try adding \(v\) to \(A\). What's the issue?
Add the edge \({\color{IndianRed}u} \rightarrow {\color{DodgerBlue}v}\) if adding \(v\) and removing \(u\) from \(A\) gives us a set that is independent in \({\cal F}_1\).
Add the edge \({\color{DodgerBlue}x} \rightarrow {\color{IndianRed}y}\) if adding \(x\) and removing \(y\) from \(A\) gives us a set that is independent in \({\cal F}_2\).
At some point, we get stuck,
and our answer is not necessarily optimal yet.
Initialize \(S := \emptyset\).
While there exists \(e \in {\cal U}\) such that
\(S \cup \{e\}\) is independent in both \({\cal F}_1\) and \({\cal F}_2\),
then update \(S \longleftarrow S \cup \{e\}\).
\(v\)
\(A\)
\(B\)
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
Set no longer independent in \({\cal F}_2\).
Add the edge \({\color{IndianRed}u} \rightarrow {\color{DodgerBlue}v}\) if adding \(v\) and removing \(u\) from \(A\) gives us a set that is independent in \({\cal F}_1\).
Add the edge \({\color{DodgerBlue}x} \rightarrow {\color{IndianRed}y}\) if adding \(x\) and removing \(y\) from \(A\) gives us a set that is independent in \({\cal F}_2\).
At some point, we get stuck,
and our answer is not necessarily optimal yet.
Initialize \(S := \emptyset\).
While there exists \(e \in {\cal U}\) such that
\(S \cup \{e\}\) is independent in both \({\cal F}_1\) and \({\cal F}_2\),
then update \(S \longleftarrow S \cup \{e\}\).
\(v\)
\(A\)
\(B\)
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
Set no longer independent in \({\cal F}_2\).
Add the edge \({\color{IndianRed}u} \rightarrow {\color{DodgerBlue}v}\) if adding \(v\) and removing \(u\) from \(A\) gives us a set that is independent in \({\cal F}_1\).
Add the edge \({\color{DodgerBlue}x} \rightarrow {\color{IndianRed}y}\) if adding \(x\) and removing \(y\) from \(A\) gives us a set that is independent in \({\cal F}_2\).
At some point, we get stuck,
and our answer is not necessarily optimal yet.
Initialize \(S := \emptyset\).
While there exists \(e \in {\cal U}\) such that
\(S \cup \{e\}\) is independent in both \({\cal F}_1\) and \({\cal F}_2\),
then update \(S \longleftarrow S \cup \{e\}\).
\(w\)
\(v\)
\(A\)
\(B\)
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
If there is an edge from \(v\) to \(w\), can drop \(w\) to fix the situation.
Add the edge \({\color{IndianRed}u} \rightarrow {\color{DodgerBlue}v}\) if adding \(v\) and removing \(u\) from \(A\) gives us a set that is independent in \({\cal F}_1\).
Add the edge \({\color{DodgerBlue}x} \rightarrow {\color{IndianRed}y}\) if adding \(x\) and removing \(y\) from \(A\) gives us a set that is independent in \({\cal F}_2\).
At some point, we get stuck,
and our answer is not necessarily optimal yet.
Initialize \(S := \emptyset\).
While there exists \(e \in {\cal U}\) such that
\(S \cup \{e\}\) is independent in both \({\cal F}_1\) and \({\cal F}_2\),
then update \(S \longleftarrow S \cup \{e\}\).
\(w\)
\(v\)
\(A\)
\(B\)
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
But now we are back to square one in terms of size.
Add the edge \({\color{IndianRed}u} \rightarrow {\color{DodgerBlue}v}\) if adding \(v\) and removing \(u\) from \(A\) gives us a set that is independent in \({\cal F}_1\).
Add the edge \({\color{DodgerBlue}x} \rightarrow {\color{IndianRed}y}\) if adding \(x\) and removing \(y\) from \(A\) gives us a set that is independent in \({\cal F}_2\).
At some point, we get stuck,
and our answer is not necessarily optimal yet.
Initialize \(S := \emptyset\).
While there exists \(e \in {\cal U}\) such that
\(S \cup \{e\}\) is independent in both \({\cal F}_1\) and \({\cal F}_2\),
then update \(S \longleftarrow S \cup \{e\}\).
\(w\)
\(v\)
\(A\)
\(B\)
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
What if there is an edge from \(w\) to \(u\)?
\(u\)
Add the edge \({\color{IndianRed}u} \rightarrow {\color{DodgerBlue}v}\) if adding \(v\) and removing \(u\) from \(A\) gives us a set that is independent in \({\cal F}_1\).
Add the edge \({\color{DodgerBlue}x} \rightarrow {\color{IndianRed}y}\) if adding \(x\) and removing \(y\) from \(A\) gives us a set that is independent in \({\cal F}_2\).
At some point, we get stuck,
and our answer is not necessarily optimal yet.
Initialize \(S := \emptyset\).
While there exists \(e \in {\cal U}\) such that
\(S \cup \{e\}\) is independent in both \({\cal F}_1\) and \({\cal F}_2\),
then update \(S \longleftarrow S \cup \{e\}\).
\(w\)
\(v\)
\(A\)
\(B\)
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
Note: \(A \cup \{u\} \setminus \{w\}\) is in \({\cal F}_1 \cap {\cal F}_2\).
\(u\)
Add the edge \({\color{IndianRed}u} \rightarrow {\color{DodgerBlue}v}\) if adding \(v\) and removing \(u\) from \(A\) gives us a set that is independent in \({\cal F}_1\).
Add the edge \({\color{DodgerBlue}x} \rightarrow {\color{IndianRed}y}\) if adding \(x\) and removing \(y\) from \(A\) gives us a set that is independent in \({\cal F}_2\).
At some point, we get stuck,
and our answer is not necessarily optimal yet.
Initialize \(S := \emptyset\).
While there exists \(e \in {\cal U}\) such that
\(S \cup \{e\}\) is independent in both \({\cal F}_1\) and \({\cal F}_2\),
then update \(S \longleftarrow S \cup \{e\}\).
\(w\)
\(v\)
\(A\)
\(B\)
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
Is \(A \cup \{u,v\} \setminus \{w\}\) is in \({\cal F}_1 \cap {\cal F}_2\)?
\(u\)
Add the edge \({\color{IndianRed}u} \rightarrow {\color{DodgerBlue}v}\) if adding \(v\) and removing \(u\) from \(A\) gives us a set that is independent in \({\cal F}_1\).
Add the edge \({\color{DodgerBlue}x} \rightarrow {\color{IndianRed}y}\) if adding \(x\) and removing \(y\) from \(A\) gives us a set that is independent in \({\cal F}_2\).
At some point, we get stuck,
and our answer is not necessarily optimal yet.
Initialize \(S := \emptyset\).
While there exists \(e \in {\cal U}\) such that
\(S \cup \{e\}\) is independent in both \({\cal F}_1\) and \({\cal F}_2\),
then update \(S \longleftarrow S \cup \{e\}\).
\(w\)
\(v\)
\(A\)
\(B\)
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
Swapping across a shortest S-T path \(P\) actually works:
\(u\)
Add the edge \({\color{IndianRed}u} \rightarrow {\color{DodgerBlue}v}\) if adding \(v\) and removing \(u\) from \(A\) gives us a set that is independent in \({\cal F}_1\).
Add the edge \({\color{DodgerBlue}x} \rightarrow {\color{IndianRed}y}\) if adding \(x\) and removing \(y\) from \(A\) gives us a set that is independent in \({\cal F}_2\).
add \(P \cap B\) to \(A\) and remove \(P \cap A\) from \(A\).
Advanced Algorithms
Part 1. Matroids & Greedy Algorithms
Part 1a. Motivation & Definition
Part 1b. Demonstrating that Greedy Works
Part 1c. Scheduling with Deadlines
Part 1d. Matroid Intersection and Examples
Part 1e. The Matroid Intersection Algorithm
If we have two disjoint spanning trees \(T_1, T_2\) in a graph, then the exchange property implies that for any \(e \in T_1\), there exists some edge \(f(e) \in T_2\)
so that
\(\left(T_1 \backslash\{e\}\right) \cup f(e)\) is again a spanning tree.
...we can, in fact, choose \(f\) to be a bijection!
Think of \(f(e)\) as the replacement for \(e\).
Prelude: Exchange Graphs
Lemma. Let \({\cal M}=({\cal U}, \mathcal{F})\) be a matroid and
let \(Y, Z \in \mathcal{F}\) be disjoint independent sets of the same size.
Define a bipartite exchange graph \(H=(Y \cup Z, E)\) with
\(E=\{(y, z):(Y \backslash y) \cup\) \(z \in \mathcal{Y}\}\);
in other words, \(z\) is adjacent to \(y\) if \(z\) can act as a replacement for \(y\).
Prelude: Exchange Graphs
Then \(H\) contains a perfect matching.
For a matroid \({\cal M}= ({\cal U}, \mathcal{F})\)
and an independent set \(Y \in \mathcal{F}\),
we can define \(H({\cal M}, Y)\) as the bipartite graph
with partitions \(Y\) and \({\cal U} \setminus Y\)
where we have an edge between \(y \in Y\) and \(x \in {\cal U} \backslash Y\) if
\((Y \backslash y) \cup\{x\} \in \mathcal{F}.\)
\(Y\)
\({\cal U}\setminus Y\)
Prelude: Exchange Graphs
Prelude: Exchange Graphs
Lemma. Let \({\cal M}=({\cal U}, \mathcal{F})\) be a matroid
and let \(Y \in \mathcal{F}\) be an independent set
and let \(Z \subseteq {\cal U}\) be any set with \(|Z|=|Y|\).
Suppose that there exists a unique
perfect matching \(N\)
in \(H({\cal M}, Y)\) between \(Y \Delta Z\).
Then \(Z \in \mathcal{F}\).
\(Y\)
\(Z\)
The Rank Function
Let \({\cal M}=({\cal U}, \mathcal{F})\) be a matroid.
Recall that an inclusionwise maximal independent set is called a basis.
Moreover, all bases have the same size which is also called the rank of \({\cal M}\).
One can generalize this to the rank function \(r_{\cal M}: 2^{\cal U} \rightarrow \mathbb{Z}_{\geq 0}\)
which is defined by:
\(r_{\cal M}(S):=\max \{|Y|: Y \subseteq S \text { and } Y \in \mathcal{F}\}\)
Lemma. Let \({\cal M}_1=\left({\cal U}, \mathcal{F}_1\right), {\cal M}_2=\left({\cal U}, \mathcal{F}_2\right)\) with rank functions \(r_1\) and \(r_2\).
Then for any independent set \(Y \in \mathcal{F}_1 \cap \mathcal{F}_2\) and any set \(X \subseteq {\cal U}\) one has
\(|Y| \leqslant r_1(X)+r_2({\cal U} \setminus X).\)
\(X\)
\(Y\)
\({\cal U}\)
Rank Upper Bound
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
Add the edge \({\color{IndianRed}u} \rightarrow {\color{DodgerBlue}v}\) if
adding \(v\) and removing \(u\) from \(A\) gives us a set that is independent in \({\cal F}_1\).
Add the edge \({\color{DodgerBlue}x} \rightarrow {\color{IndianRed}y}\) if
adding \(x\) and removing \(y\) from \(A\) gives us a set that is independent in \({\cal F}_2\).
\(A\)
\(B\)
Consider a shortest \(S-T\) path \(P\).
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
Add the edge \({\color{IndianRed}u} \rightarrow {\color{DodgerBlue}v}\) if
adding \(v\) and removing \(u\) from \(A\) gives us a set that is independent in \({\cal F}_1\).
Add the edge \({\color{DodgerBlue}x} \rightarrow {\color{IndianRed}y}\) if
adding \(x\) and removing \(y\) from \(A\) gives us a set that is independent in \({\cal F}_2\).
Want to show: \(A \setminus {\color{slategray}(P \cap A)} \cup {\color{IndianRed}(B \cap P)}\) is independent in both \({\cal F}_1\) and \({\cal F}_2\).
\(A\)
\(B\)
Consider a shortest \(S-T\) path \(P\).
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
Add the edge \({\color{IndianRed}u} \rightarrow {\color{DodgerBlue}v}\) if
adding \(v\) and removing \(u\) from \(A\) gives us a set that is independent in \({\cal F}_1\).
Add the edge \({\color{DodgerBlue}x} \rightarrow {\color{IndianRed}y}\) if
adding \(x\) and removing \(y\) from \(A\) gives us a set that is independent in \({\cal F}_2\).
Want to show: \(A \setminus {\color{slategray}(P \cap A)} \cup {\color{IndianRed}(B \cap P)}\) is independent in both \({\cal F}_1\) and \({\cal F}_2\).
\(A\)
\(B\)
This is the proposed new independent set; call it \(C\).
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
Add the edge \({\color{IndianRed}u} \rightarrow {\color{DodgerBlue}v}\) if
adding \(v\) and removing \(u\) from \(A\) gives us a set that is independent in \({\cal F}_1\).
Add the edge \({\color{DodgerBlue}x} \rightarrow {\color{IndianRed}y}\) if
adding \(x\) and removing \(y\) from \(A\) gives us a set that is independent in \({\cal F}_2\).
Want to show: \(A \setminus {\color{slategray}(P \cap A)} \cup {\color{IndianRed}(B \cap P)}\) is independent in both \({\cal F}_1\) and \({\cal F}_2\).
Let \(D\) denote \(C \setminus \{~~~~~\} \).
\(A\)
\(B\)
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
Add the edge \({\color{IndianRed}u} \rightarrow {\color{DodgerBlue}v}\) if
adding \(v\) and removing \(u\) from \(A\) gives us a set that is independent in \({\cal F}_1\).
Add the edge \({\color{DodgerBlue}x} \rightarrow {\color{IndianRed}y}\) if
adding \(x\) and removing \(y\) from \(A\) gives us a set that is independent in \({\cal F}_2\).
Want to show: \(A \setminus {\color{slategray}(P \cap A)} \cup {\color{IndianRed}(B \cap P)}\) is independent in both \({\cal F}_1\) and \({\cal F}_2\).
A perfect matching.
\(A\)
\(B\)
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
Add the edge \({\color{IndianRed}u} \rightarrow {\color{DodgerBlue}v}\) if
adding \(v\) and removing \(u\) from \(A\) gives us a set that is independent in \({\cal F}_1\).
Add the edge \({\color{DodgerBlue}x} \rightarrow {\color{IndianRed}y}\) if
adding \(x\) and removing \(y\) from \(A\) gives us a set that is independent in \({\cal F}_2\).
Want to show: \(A \setminus {\color{slategray}(P \cap A)} \cup {\color{IndianRed}(B \cap P)}\) is independent in both \({\cal F}_1\) and \({\cal F}_2\).
Cannot have jumps like this.
\(A\)
\(B\)
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
Add the edge \({\color{IndianRed}u} \rightarrow {\color{DodgerBlue}v}\) if
adding \(v\) and removing \(u\) from \(A\) gives us a set that is independent in \({\cal F}_1\).
Add the edge \({\color{DodgerBlue}x} \rightarrow {\color{IndianRed}y}\) if
adding \(x\) and removing \(y\) from \(A\) gives us a set that is independent in \({\cal F}_2\).
Want to show: \(A \setminus {\color{slategray}(P \cap A)} \cup {\color{IndianRed}(B \cap P)}\) is independent in both \({\cal F}_1\) and \({\cal F}_2\).
Why?
\(A\)
\(B\)
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
Add the edge \({\color{IndianRed}u} \rightarrow {\color{DodgerBlue}v}\) if
adding \(v\) and removing \(u\) from \(A\) gives us a set that is independent in \({\cal F}_1\).
Add the edge \({\color{DodgerBlue}x} \rightarrow {\color{IndianRed}y}\) if
adding \(x\) and removing \(y\) from \(A\) gives us a set that is independent in \({\cal F}_2\).
Want to show: \(A \setminus {\color{slategray}(P \cap A)} \cup {\color{IndianRed}(B \cap P)}\) is independent in both \({\cal F}_1\) and \({\cal F}_2\).
We would obtain a shorter path!
\(A\)
\(B\)
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
Add the edge \({\color{IndianRed}u} \rightarrow {\color{DodgerBlue}v}\) if
adding \(v\) and removing \(u\) from \(A\) gives us a set that is independent in \({\cal F}_1\).
Add the edge \({\color{DodgerBlue}x} \rightarrow {\color{IndianRed}y}\) if
adding \(x\) and removing \(y\) from \(A\) gives us a set that is independent in \({\cal F}_2\).
Want to show: \(A \setminus {\color{slategray}(P \cap A)} \cup {\color{IndianRed}(B \cap P)}\) is independent in both \({\cal F}_1\) and \({\cal F}_2\).
Notice that among the \(A \rightarrow B\) edges, the dashed edges form a unique perfect matching.
\(A\)
\(B\)
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
Recall the set \(D\).
\(A\)
\(B\)
\(A\)
\(D\)
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
We have shown a unique perfect matching \(D \longleftrightarrow A\); implying \(D\) is independent in \({\cal F}_1\).
\(A\)
\(B\)
\(A\)
\(D\)
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
We have shown a unique perfect matching \(D \longleftrightarrow A\); implying \(D\) is independent in \({\cal F}_1\).
\(A\)
\(B\)
\(A\)
\(D\)
\(P \subset {\cal U}, r(P) = 100\)
\(P \subset {\cal U}, r(P) = 100\)
\(r(P \cup \{~~~~~\}) = 101\)
Further, suppose \(Q\) is an independent set.
\(Q \cup \{~~~~~\}\) is also an independent set.
What can we say about \(Q \cup \{~~~~~\}\)?
\(Q \subseteq P; |Q| = 100\)
Suppose we have:
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
We have shown a unique perfect matching \(D \longleftrightarrow A\); implying \(D\) is independent in \({\cal F}_1\).
\(A\)
\(B\)
What is the rank of \(A \cup C\),
where \(C\) is the new independent set under consideration?
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
We have shown a unique perfect matching \(D \longleftrightarrow A\); implying \(D\) is independent in \({\cal F}_1\).
\(A\)
\(B\)
What is the rank of \(A \cup C\),
where \(C\) is the new independent set under consideration?
\(r_{{\cal M}_1}(A \cup C) \geqslant r_{{\cal M}_1}(A \cup \{~~~~~\}) = |A|+1 \)
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
We have shown a unique perfect matching \(D \longleftrightarrow A\); implying \(D\) is independent in \({\cal F}_1\).
\(A\)
\(B\)
On the other hand,
we claim that:
\(r_{{\cal M}_1}(A \cup C) \geqslant r_{{\cal M}_1}(A \cup \{~~~~~\}) = |A|+1 \)
\(r_{{\cal M}_1}(A \cup C \setminus \{~~~~~\}) \leqslant |A|\)
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
We have shown a unique perfect matching \(D \longleftrightarrow A\); implying \(D\) is independent in \({\cal F}_1\).
\(A\)
\(B\)
(Notice that we are done if both statements below are true;
apply to \(P = A \cup C \setminus \{~~~~~\}\) and \(Q = D\) from the previous argument.)
\(r_{{\cal M}_1}(A \cup C) \geqslant r_{{\cal M}_1}(A \cup \{~~~~~\}) = |A|+1 \)
\(r_{{\cal M}_1}(A \cup C \setminus \{~~~~~\}) \leqslant |A|\)
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
We have shown a unique perfect matching \(D \longleftrightarrow A\); implying \(D\) is independent in \({\cal F}_1\).
\(A\)
\(B\)
Suppose this is not true,
and there is an independent set of size \(|A|+ 1\) in \(A \cup C \setminus \{~~~~~\}\).
\(r_{{\cal M}_1}(A \cup C) \geqslant r_{{\cal M}_1}(A \cup \{~~~~~\}) = |A|+1 \)
\(r_{{\cal M}_1}(A \cup C \setminus \{~~~~~\}) \leqslant |A|\)
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
We have shown a unique perfect matching \(D \longleftrightarrow A\); implying \(D\) is independent in \({\cal F}_1\).
\(A\)
\(B\)
There is an independent set of size \(|A|+ 1\) in \(A \cup C \setminus \{~~~~~\}\):
what does it look like?
\(r_{{\cal M}_1}(A \cup C) \geqslant r_{{\cal M}_1}(A \cup \{~~~~~\}) = |A|+1 \)
\(r_{{\cal M}_1}(A \cup C \setminus \{~~~~~\}) \leqslant |A|\)
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
We have shown a unique perfect matching \(D \longleftrightarrow A\); implying \(D\) is independent in \({\cal F}_1\).
\(A\)
\(B\)
There is an independent set of size \(|A|+ 1\) in \(A \cup C \setminus \{~~~~~\}\):
what does it look like?
\(r_{{\cal M}_1}(A \cup C) \geqslant r_{{\cal M}_1}(A \cup \{~~~~~\}) = |A|+1 \)
\(r_{{\cal M}_1}(A \cup C \setminus \{~~~~~\}) \leqslant |A|\)
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
We have shown a unique perfect matching \(D \longleftrightarrow A\); implying \(D\) is independent in \({\cal F}_1\).
\(A\)
\(B\)
\(r_{{\cal M}_1}(A \cup C) \geqslant r_{{\cal M}_1}(A \cup \{~~~~~\}) = |A|+1 \)
\(r_{{\cal M}_1}(A \cup C \setminus \{~~~~~\}) \leqslant |A|\)
Observe that none of the elements of \(D \cap B\) are in \(S\),
otherwise we would again have a shorter path.
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
We have shown a unique perfect matching \(D \longleftrightarrow A\); implying \(D\) is independent in \({\cal F}_1\).
\(A\)
\(B\)
There is an independent set of size \(|A|+ 1\) in \(A \cup C \setminus \{~~~~~\}\):
what does it look like?
\(r_{{\cal M}_1}(A \cup C) \geqslant r_{{\cal M}_1}(A \cup \{~~~~~\}) = |A|+1 \)
\(r_{{\cal M}_1}(A \cup C \setminus \{~~~~~\}) \leqslant |A|\)
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
We have shown a unique perfect matching \(D \longleftrightarrow A\); implying \(D\) is independent in \({\cal F}_1\).
\(A\)
\(B\)
There is an independent set of size \(|A|+ 1\) in \(A \cup C \setminus \{~~~~~\}\):
what does it look like?
\(r_{{\cal M}_1}(A \cup C) \geqslant r_{{\cal M}_1}(A \cup \{~~~~~\}) = |A|+1 \)
\(r_{{\cal M}_1}(A \cup C \setminus \{~~~~~\}) \leqslant |A|\)
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
We have shown a unique perfect matching \(D \longleftrightarrow A\); implying \(D\) is independent in \({\cal F}_1\).
\(A\)
\(B\)
There is an independent set of size \(|A|+ 1\) in \(A \cup C \setminus \{~~~~~\}\):
what does it look like?
\(r_{{\cal M}_1}(A \cup C) \geqslant r_{{\cal M}_1}(A \cup \{~~~~~\}) = |A|+1 \)
\(r_{{\cal M}_1}(A \cup C \setminus \{~~~~~\}) \leqslant |A|\)
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
We have shown a unique perfect matching \(D \longleftrightarrow A\); implying \(D\) is independent in \({\cal F}_1\).
\(A\)
\(B\)
\(r_{{\cal M}_1}(A \cup C) \geqslant r_{{\cal M}_1}(A \cup \{~~~~~\}) = |A|+1 \)
\(r_{{\cal M}_1}(A \cup C \setminus \{~~~~~\}) \leqslant |A|\)
\(S := \{x \mid A \cup \{x\} \in {\cal F}_1\}\).
\(T := \{x \mid A \cup \{x\} \in {\cal F}_2\}\).
We have shown a unique perfect matching \(D \longleftrightarrow A\); implying \(D\) is independent in \({\cal F}_1\).
\(A\)
\(B\)
\(r_{{\cal M}_1}(A \cup C) \geqslant r_{{\cal M}_1}(A \cup \{~~~~~\}) = |A|+1 \)
\(r_{{\cal M}_1}(A \cup C \setminus \{~~~~~\}) \leqslant |A|\)
...and we have shown that \(D \cup \{~~~~~\} = C \in {\cal F}_1\).
A symmetric argument shows that \(D \cup \{~~~~~\} = C \in {\cal F}_2\).
Rank Upper Bound
Lemma. Let \({\cal M}_1=\left({\cal U}, \mathcal{F}_1\right), {\cal M}_2=\left({\cal U}, \mathcal{F}_2\right)\) with rank functions \(r_1\) and \(r_2\).
Then for any independent set \(Y \in \mathcal{F}_1 \cap \mathcal{F}_2\) and any set \(X \subseteq {\cal U}\) one has
\(|Y| \leqslant r_1(X)+r_2({\cal U} \setminus X).\)
\(X\)
\(Y\)
\({\cal U}\)
Lemma. Suppose there is no path from a node in \(S\) to a node in \(T\).
Then our choice of \(A\) is optimal.
In particular we can find a subset \(Z \subseteq {\cal U}\) so that
\(|A|=r_{{\cal M}_1}(Z)+r_{{\cal M}_2}({\cal U} \backslash Z)\).
Meeting the Rank Upper Bound
AdvAlgo 01
By Neeldhara Misra
AdvAlgo 01
- 259