









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










1
0
0
0
− 1
3
2
1 1
1
1
1
1 1
1
1
1 2
Fig. 7.5. A shortest path problem interpreted as network flow problem, and an optimal solution revealed in bold arcs.
We start with the example of finding maximum weight trees and forests in undi- rected graphs, and then we generalise our findings to submodular optimisation prob- lems and the associated notion of matroids.
Definition 8.1. Let G = (V, E) be an undirected graph with node set V and edge set E.
i) A forest in G is a subgraph G′^ = (V ′^ , E ′^ ) that contains no cycles, that is, any pair of nodes is connected in G′^ via at most one path in G′^. ii) A tree in G is a connected forest, that is, a forest that contains a unique path between any pair of nodes (i, j). iii) A spanning forest in G is a tree that covers every node in V. iv) A spanning tree in G is a spanning forest that is a tree. Proposition 8.2. Let G = (V, E) be an undirected graph with n = |V | nodes. the following characterisations are equivalent,
i) G is a spanning tree, ii) G is a spanning forest that contains exactly n − 1 edges, iii) G is an edge-minimal connected graph that spans V , that is, such that every node in V is covered, iv) G contains a unique path between every pair of nodes of V , v) G is a graph such that the addition of an edge not in E creates a unique cycle. Proof. Left as an exercise.
8.1. The Maximum Weight Spanning Tree Problem. Let G = (V, E) be an undirected graph with weights c (^) e (e ∈ E). The Maximum Weight Spanning Tree Problem is to find a spanning tree in G for which the sum of edge weights is maximised:
Fig. 8.1. Examples of a forest, a spanning forest, a tree, and a spanning tree.
(MWST) max
e∈E ′
c (^) e : E ′^ ⊆ E s.t. G′^ = (V, E ′^ ) is a spanning tree
Note that if G is not connected, then the feasible set is empty, and (MWST) is an infeasible problem. So far, (MWST) is a formulation as a combinatorial optimisation problem, but at the end of this section we will see that it also has a formulation as an integer programming problem that makes it a special case of a general family of IPs that can be solved via a greedy algorithm. Specialised to our problem, the greedy algorithm becomes the following:
Algorithm 8.3 (Greedy Algorithm for (MWST)).
(^1 )
4
2
(^65)
7
8
9
6
4
2
(^69)
5 3
3
5
12
9
10
Fig. 8.4. Step 3 of the greedy algorithm applied to Example 29.
(^1 )
4
2
(^65)
7
8
9
6
4
2
(^69)
5 3
3
5
12
9
10
Fig. 8.5. Step 4 of the greedy algorithm applied to Example 29.
8.2. The Maximum Weight Forest Problem. This is a slight variation of (MWST) in which the aim is to find a forest in G = (V, E) of maximum weight,
(MWF) max
e∈E ′
c (^) e : E ′^ ⊆ E s.t. G′^ = (V, E ′^ ) is a forest
Note that, contrary to (MWST), (MWF) is always feasible. This problem is also a special case of the problem class we will discuss later, and hence it is also efficiently solvable via the greedy algorithm. Specialised to this case it takes the following form:
(^1 )
4
2
(^65)
7
8
9
6
4
2
(^69)
5 3
3
5
12
9
10
Fig. 8.6. Step 5 of the greedy algorithm applied to Example 29. Note that at this stage it is not edge { 5 , 6 } that is chosen, despite its heavier weight in comparison to { 6 , 7 }, because it would create a cycle.
(^1 )
4
2
(^65)
7
8
9
6
4
2
(^69)
5 3
3
5
12
9
10
Fig. 8.7. Step 6 of the greedy algorithm applied to Example 29. After this step all nodes are covered and the algorithm stops.
Algorithm 8.4 (Greedy Algorithm for (MWF)).
Theorem 8.8. The greedy algorithm solves the submodular optimisation problem to optimality in O
n(c (^) f + log n)
time, where c (^) f is the amount of work required per function evaluation of f.
Proof. The complexity claim is immediate, as steps 2 and 3 take at most nc (^) f time, and step 1 takes O(n log n) time. Thus, the claim is all about the algorithm yielding an optimal vector x.
Claim 1: x is (SOP)-feasible: Since f is nondecreasing, xi = f (S i^ ) − f (S i−^1 ) ≥ 0 (i = 1,... , r), and since xi = 0 (i = r + 1,... , n), the nonnegativity constraints x ≥ 0 are satisfied. Further, for all T ∈ P(N ) and j ∈ T , applying submodularity to A = S j−^1 and B = S j^ ∩ T , we find
f (S j−^1 ) + f (S j^ ∩ T ) = f (A) + f (B) ≥ f (A ∩ B) + f (A ∪ B) = f (S j−^1 ∩ T ) + f (S j^ ), (since j ∈ T ),
and hence,
f (S j^ ) − f (S j−^1 ) ≤ f (S j^ ∩ T ) − f (S j−^1 ∩ T ). (8.1)
Thus, ∑
j∈T
xj =
j∈T ∩S r
f (S j^ ) − f (S j−^1 )
(by construction of x)
j∈T ∩S r
f (S j^ ∩ T ) − f (S j−^1 ∩ T )
(by inequality (8.1))
j∈S r
f (S j^ ∩ T ) − f (S j−^1 ∩ T )
(since f is nondecreasing)
= f (S r^ ∩ T ) − f (∅) ≤ f (T ).
Claim 2: The objective value at x,
z ∗^ =
∑^ r
i=
c (^) i
f (S i^ ) − f (S i−^1 )
is optimal for (SOP): We prove this claim by constructing a dual feasible solution with the same dual objective value. The claim then follows from the LP duality theorem. It is easily verified that the LP dual of (SOP) is
(D) min
S∈P(N )
f (S) · y (^) S
s.t.
S:j∈S
y (^) S ≥ c (^) j ∀ j ∈ N,
y (^) S ≥ 0 ∀ S ∈ P(N ).
For i = 1,... , r − 1 set y (^) S i = c (^) i − c (^) i+1. Set y (^) S r = c (^) r , and set y (^) S = 0 for all other S ∈ P(N ). Then y is (D)-feasible, since y (^) S ≥ 0 for all S ∈ P(N ), and furthermore for j ≤ r,
∑
S:j∈S
y (^) S =
∑^ r
i=j
y (^) S i =
r∑− 1
i=j
(c (^) i − c (^) i+1 ) + c (^) r = c (^) j ,
whereas for j > r, ∑
S:j∈S
y (^) S = 0 ≥ c (^) j.
The dual objective value at y is
∑^ r
i=
f (S i^ )y (^) S i =
∑^ r−^1
i=
f (S i^ )(c (^) i − c (^) i+1 ) + f (S r^ )c (^) r
∑^ r
i=
c (^) i
f (S i^ ) − f (S i−^1 )
= z ∗^.
We have seen that the submodular optimsation problem is an LP with O(exp(n)) constraints that can be solved in O(n). While this is in itself interesting, it is natu- ral to ask what the connections with integer programming are: Observe that if f is integer valued, then the greedy solution of (SOP) is integral! We will now see that (SOP) is the LP relaxation of a related combinatorial optimisation problem. The above observation will then imply that this relaxation is tight.
Definition 8.9. f : P(N ) → R is called a submodular rank function if the following are satisfied,
i) f is submodular, ii) f is increasing, iii) f (∅) = 0, iv) for all S ∈ P(N ) and j /∈ S,
f (S ∪ {j}) − f (S) ∈ { 0 , 1 }.
Proposition 8.10. Let f be a submodular rank function. Then i) f (A) ≤ |A| for all A ∈ P(N ), ii) If f (A) = |A| then f (B) = |B| for all B ⊂ A. iii) Let xA^ be the incidence vector of A ∈ P(N ), defined by
xAj =
1 if j ∈ A, 0 otherwise.
Then xA^ ∈ P (f ) if and only if f (A) = |A|. Proof. The only nontrivial part is iii). If f (A) < |A| then
j∈A x A j =^ |A|^ > f^ (A) and xA^ ∈/ P (f ). Conversely, if f (A) = |A|, then for all S ∈ P(N ),
∑
j∈S
xAj = |A ∩ S|
ii) = f (A ∩ S) ≤ f (S).
f (B) = f (A), or else all cardinality maximising forests in A contain e. But then F \ {e} is a forest in B of cardinality |F | − 1 , which must be of maximum cardinality by nonexistence of H and (8.2). Thus, in both cases we have
f (A) − f (B) ∈ { 0 , 1 }.
So far we have shown that f is an increasing rank function. It remains to show submodularity. This will be part of the problem sheets.
Note finally that applying Algorithm 8.7 to the submodular optimisation problem associated with f is the same as Algorithm 8.4.
Definition 9.1. Let G = (V, E) be a graph. A matching M ⊆ E is a set of disjoint edges, that is, such that no two elements of M share a common node as an endpoint (see Figure 6.2 for an example). A covering by nodes R ⊆ V is a set of nodes such that every edge in E has at least one endpoint in R (see Figure 6.3 for an example).
In Example 25 we showed that the maximum cardinality matching problem
(M) max M⊆E
{|M | : M is a matching}
and the minimum cardinality covering problem
(C) min R⊆V {|R| : R is a covering}
form a weak dual pair, that is, |M | ≤ |R| for all matchings M and coverings R. Our goal is now to build an algorithm for a special case of the max cardinality matching problem that finds successively better matchings. The following concepts are used to find updates to a matching M of a graph G = (V, E):
Definition 9.2. An alternating path with respect to M is a sequence of nodes P = (v 0 , v 1 ,... , vp ) such that
i) e (^) i+1 := (vi , vi+1 ) ∈ E for (i = 0,... , p − 1), ii) e (^) i ∈ M for i even, and e (^) i ∈ E \ M for i odd, iii) v 0 is exposed (i.e., not covered by any e ∈ M ),
Furthermore, P is called augmenting path if p is odd and vp is exposed, see Figure 9.
Lemma 9.3. If P is an augmenting path with respect to M then
M ′^ = (M ∪ P ) \ (M ∩ P )
is a matching with |M ′^ | = |M | + 1, where we write M ∪ P for M ∪ {(vi , vi+1 ) : i = 0 ,... , p − 1 } and M ∩ P for M ∩ {(vi , vi+1 ) : i = 0,... , p − 1 }.
Fig. 9.1. Examples of an alternating and an augmenting path.
Proof. Since v 0 and vp are exposed in M , they are incident to exactly one edge in M ′^. Any other node along P remains incident to exactly one edge, although this edge changes from an even one to an odd one. For any node that doesn’t lie on P any inci- dent edge lies in M iff it lie in M ′^. Thus, all nodes are incident to at most 1 edge in M ′^ , so that M ′^ is a matching. Finally, M ∩ P = {(vi , vi+1 ) : i = 1, 3 ,... , p − 2 } is of cardi- nality (p − 1)/2 and M ′^ ∩ P = {(vi , vi+1 ) : i = 0, 2 ,... , p − 1 } of cardinality (p + 1)/2. Since M and M ′^ coincide outside of P , |M ′^ | = |M |−(p−1)/2+(p+1)/2 = |M |+1.
The following result now provides an optimality condition for the maximum car- dinality matching problem:
Theorem 9.4. A matching M for G = (V, E) is of maximum cardinality if and only if there does not exist an augmenting path with respect to M.
Proof. The “only if” part follows from Lemma 9.3. To show the “if” part, we assume that M is not of maximum cardinality and construct an augmenting path. Let M ′^ be a matching such that |M ′^ | > |M |, and consider the graph (V, F ) where F = (M ∪M ′^ )\ (M ∩M ′^ ). Since each node v ∈ V is incident to at most one edge from M and M ′^ each, it is incident to at most two edges in F. The connected components of (V, F ) therefore consist of paths and cycles, see Figure 9.2. Since M and M ′^ are matches, the edges in each connected component must alternate between elements of M and M ′^. For a component that is a cycle, this can only be true if it contains an equal numbers of elements from M and M ′^. Likewise, a component consisting of a path of even length contains equal numbers of elements from M and M ′^. Since F contains more elements from M ′^ than from M , at least one of the connected com- ponents must be a path of odd length starting and finishing with an edge from M ′^. This path is an augmenting path.
Theorem 9.4 leads to a conceptual algorithm for the max cardinality matching problem:
Algorithm 9.5. [Conceptual algorithm]
V1 V
Fig. 9.3. Example of a bipartite graph. Both pictures show the same graph, but the represen- tation on the right makes it evident that the graph is bipartite.
1
2
3
4
5
6
7
1
2
3
4
5
6
7
2
5
1
2
3
4
5
6
7
2
1
2
3
4
5
6
7
2
5
3 exposed!
1
2
3
4
5
6
7
2
5
3
Fig. 9.4. In pursuit of an augmenting path with respect to the matching given by the red edges, we first label all the exposed nodes in V 1 (in this case only node 2 ). Since an augmenting path starting in node 2 would have to pass over to V 2 via an unmarked edge, we label all unlabelled candidate nodes (in this case only node 5 ) by 2. To continue an augmenting path, one has to pass back to V 1 via marked nodes (thus labelling node 3 by 5 ), and then again to V 2 via an unmarked edge. If, carrying on this fashion, an exposed node in V 2 is found, an augmenting path will have been traced out by the labels.
Theorem 9.8 (Correctness of Algorithm 9.7). Algorithm 9.7 finds an augmenting path with respect to M or detects nonexistence thereof in O(m) time, where m = |E|.
Proof. The bound on the running time arises from the fact that every time a node is scanned, a different edge is explored. Hence, step 2 takes are at most m iterations, each at a constant cost. It is trivial to see that when the algorithm enters step iii), an augmenting path P is found. It suffices thus to prove that when the algorithm enters step 3, then an augmenting path does not exist. By Theorem 9.4, this is the same as claiming that the input matching M is of maximum cardinality. It follows from Proposition 13 of Section ?? (weak duality between max cardinality matching and min cardinality covering problems) that to show this, it suffices to construct a covering R ⊆ V such that |M | = |R|.
Let V 1 + , V 2 + be the nodes of V 1 and V 2 that are labelled by the time the algorithm reaches step 3, and let V 1 − , V 2 − be the unlabelled nodes. We claim that R = V 1 − ∪ V 2 + is a node covering of E such that |M | = |R|. The only way R could fail to be a node covering is for there to exist an edge (i, j) ∈ E with i ∈ V 1 + and j ∈ V 2 −. There cannot exist an edge (i, j) ∈ E \ M with i ∈ V 1 + and j ∈ V 2 − , since all nodes have been scanned, and when i was scanned j would have been labelled. There also cannot exist any edge (i, j) ∈ M with i ∈ V 1 + and j ∈ V 2 − , since then i would not be exposed, and the only way it could have got labelled would be if j got scanned. Therefore, all edges in E are covered by nodes from R, as claimed.
It remains to argue that |M | = |R|: By assumption of termination in step 3, no exposed nodes have been found in V 2 +. For every j ∈ V 2 + there therefore exists i ∈ V 1 with (i, j) ∈ M. When j got scanned, i was labelled, so we have i ∈ V 1 +. On the other hand, for every i ∈ V 1 − there exists j ∈ V 2 such that (i, j) ∈ M , for otherwise i is exposed and would have been labelled with ∗, so that i ∈ V 1 +. It must further be the case that j ∈ V 2 − , for otherwise i would have been labelled with j when j was scanned. Every element in V 1 − ∪ V 2 + can thus be associated with a different edge from M , so that we have
|R| = |V 1 − ∪ V 2 + | ≤ |M |.
But weak duality says that |M | ≤ |R|, so that we have |M | = |R|, as claimed.
Corollary 9.9 (K¨onig’s Theorem). in bipartite graphs the maximum cardinality matching problem and the minimum cardinality covering problem are strong duals of each other.
Proof. Given a bipartite graph, consider running Algorithm 9.7 repeatedly, start- ing with the empty matching M = ∅ and using any augmented paths found to find a better matching. The algorithm must terminate in finite time, as the cardinality of a matching can increase at most m times. In the last iteration, Algorithm 9.7 must terminate in step 3. The proof of Theorem 9.8 then shows that there exists a covering with the same cardinality as the matching that has been constructed.
Definition 9.10. Any labelling of G that can be produced by a valid partial run of Algorithm 9.7 is called a valid labelling with for G.
1’ (^) 6’
1 2 3 4 5 6 7 8 9 10
2’ 3’ 4’^ 5’ 7’ 8’ 9’ 10’
Fig. 9.5. The greedy inpection of the graph of Example 31 reveals a matching of cardinality 9.
1’ 6’
1 2 3 4 5 6 7 8 9 10
2’ 3’ 4’ 5’ 7’ 8’ 9’ 10’
1 1
6’ 1’ (^) 2’ 8’ 4’ (^) 10’
8 8 4 8
Fig. 9.6. Labeling and scanning reveals that the greedy matching was optimal.