Branching by Edmonds: Difference between revisions
No edit summary |
No edit summary |
||
Line 40: | Line 40: | ||
Obviously, <math>B''</math> is a branching, so we have to prove that it has maximum weight. By induction hypothesis, <math>B</math> is optimal for the shrunken graph. Let <math>B_{\mathrm{opt}}</math> be a maximum branching in <math>G</math> such that, among all maximum branchings in <math>G</math>, <math>B_{\mathrm{opt}}</math> shares as many arcs as possible with <math>B''</math>. We have to show <math>B_{\mathrm{opt}}=B''</math>. | Obviously, <math>B''</math> is a branching, so we have to prove that it has maximum weight. By induction hypothesis, <math>B</math> is optimal for the shrunken graph. Let <math>B_{\mathrm{opt}}</math> be a maximum branching in <math>G</math> such that, among all maximum branchings in <math>G</math>, <math>B_{\mathrm{opt}}</math> shares as many arcs as possible with <math>B''</math>. We have to show <math>B_{\mathrm{opt}}=B''</math>. | ||
First note that the cycles of <math>G'</math> are node-disjoint because two cycles sharing one or more nodes must come together at some node, so this node would have two incoming arcs in <math>G'</math> | First note that the cycles of <math>G'</math> are node-disjoint because two cycles sharing one or more nodes must come together at some node, so this node would have two incoming arcs in <math>G'</math>. | ||
Consider some cycle <math>C'</math>of <math>G'</math> (possibly <math>C'=C</math>). | Consider some cycle <math>C'</math>of <math>G'</math> (possibly <math>C'=C</math>). Next we show that <math>B_{\mathrm{opt}}</math> contains all arcs of <math>C'</math> except one. So, suppose for a contradiction that <math>B_}\mathrm{opt}}</math> does not contain the arcs <math>(v_1,w_1),\ldots,(v_k,w_k)</math> of <math>C'</math>, and that <math>k>1</math>. Since <math>B_{\mathrm{opt}}</math> is as close as possible to <math>B''</math>, replacing the incoming arc of any <math>(w_i)</math> by <math>(v_i,w_i)</math> in <math>B_{\mathrm{opt}}</math> and doing nothing else, would yield a result that is not a branching anymore. Since the indegrees do not change, this means that adding <math>(v_i,w_i)</math> to <math>B_{\mathrm{opt}}</math> would close cyce. In other words, there is a path <math>p_i</math> in <math>B_{\math{opt}}</math> from <math>w_i</math> | ||
Revision as of 11:00, 11 October 2014
Abstract view
Algorithmic problem: Maximum branching
Definition:
- An arc [math]\displaystyle{ (v,w)\in A }[/math] is critical if its weight is not smaller than the weight of any other incoming arc of [math]\displaystyle{ w }[/math].
- A critical subgraph [math]\displaystyle{ G'=(V,A') }[/math] of [math]\displaystyle{ G }[/math] contains one critical arc [math]\displaystyle{ (v,w) }[/math] for every node [math]\displaystyle{ w\in V }[/math] with positive indegree and no further arcs.
Type of algorithm: recursion.
Invariant: The output of a recursive call is a maximum branching of the weighted graph that was the argument of this recursive call.
Basic operation at the beginning of each recursive step: compute a critical subgraph [math]\displaystyle{ G'=(V,A') }[/math] for the input graph [math]\displaystyle{ G }[/math].
Induction basis
Abstract view: Terminate if [math]\displaystyle{ G' }[/math] is cycle-free.
Proof: If [math]\displaystyle{ G' }[/math] is cycle-free, it is a branching. Consider some other branching [math]\displaystyle{ B }[/math]. We have to show that [math]\displaystyle{ B }[/math] does not have more total weight than [math]\displaystyle{ G' }[/math].
By definition, a critical graph contains one incoming arc for each node that does have incoming arcs. Therefore, for each arc [math]\displaystyle{ a }[/math] of [math]\displaystyle{ B }[/math], there is an arc [math]\displaystyle{ a' }[/math] in [math]\displaystyle{ G' }[/math] pointing to the same node. Due to the choice of arcs for [math]\displaystyle{ G' }[/math], it is [math]\displaystyle{ w(a)\leq w(a') }[/math].
Induction step
Abstract view:
- Identify some cycle [math]\displaystyle{ Z }[/math] in [math]\displaystyle{ G' }[/math].
- Let [math]\displaystyle{ W }[/math] denote the minimum weight of all arcs on [math]\displaystyle{ Z }[/math].
- For every arc [math]\displaystyle{ (v,w)\in A }[/math] pointing from some node [math]\displaystyle{ v }[/math] outside [math]\displaystyle{ Z }[/math] to some node [math]\displaystyle{ w }[/math] on [math]\displaystyle{ Z }[/math]:
- Decrease the weight of [math]\displaystyle{ (v,w) }[/math] by [math]\displaystyle{ w(v',w)-W\geq 0 }[/math], where [math]\displaystyle{ (v',w) }[/math] is the incoming arc of [math]\displaystyle{ w }[/math] on [math]\displaystyle{ Z }[/math].
- If the new weight of [math]\displaystyle{ (v,w) }[/math] is not positive, remove [math]\displaystyle{ (v,w) }[/math] from [math]\displaystyle{ G }[/math].
- Shrink [math]\displaystyle{ Z }[/math] into one new super-node, where every arc pointing to (resp., from) some node on [math]\displaystyle{ Z }[/math] now points to (from) that super-node.
- Call the algorithm recursively for the modified weighted graph after shrinking, giving branching [math]\displaystyle{ B }[/math].
- Unshrink the graph.
- Add all arcs of [math]\displaystyle{ Z }[/math] to [math]\displaystyle{ B }[/math] giving [math]\displaystyle{ B' }[/math].
- If [math]\displaystyle{ B }[/math] contains an arc [math]\displaystyle{ (v,w) }[/math] such that [math]\displaystyle{ v }[/math] is outside [math]\displaystyle{ Z }[/math] and [math]\displaystyle{ w }[/math] is on [math]\displaystyle{ Z }[/math]: remove the incoming arc of [math]\displaystyle{ w }[/math] on [math]\displaystyle{ Z }[/math] from [math]\displaystyle{ B }[/math]; otherwise, remove one arc with weight [math]\displaystyle{ W }[/math] on [math]\displaystyle{ Z }[/math]. Let [math]\displaystyle{ B'' }[/math] be the result in both cases.
- Return [math]\displaystyle{ B'' }[/math].
Proof: Obviously, [math]\displaystyle{ B'' }[/math] is a branching, so we have to prove that it has maximum weight. By induction hypothesis, [math]\displaystyle{ B }[/math] is optimal for the shrunken graph. Let [math]\displaystyle{ B_{\mathrm{opt}} }[/math] be a maximum branching in [math]\displaystyle{ G }[/math] such that, among all maximum branchings in [math]\displaystyle{ G }[/math], [math]\displaystyle{ B_{\mathrm{opt}} }[/math] shares as many arcs as possible with [math]\displaystyle{ B'' }[/math]. We have to show [math]\displaystyle{ B_{\mathrm{opt}}=B'' }[/math].
First note that the cycles of [math]\displaystyle{ G' }[/math] are node-disjoint because two cycles sharing one or more nodes must come together at some node, so this node would have two incoming arcs in [math]\displaystyle{ G' }[/math].
Consider some cycle [math]\displaystyle{ C' }[/math]of [math]\displaystyle{ G' }[/math] (possibly [math]\displaystyle{ C'=C }[/math]). Next we show that [math]\displaystyle{ B_{\mathrm{opt}} }[/math] contains all arcs of [math]\displaystyle{ C' }[/math] except one. So, suppose for a contradiction that [math]\displaystyle{ B_}\mathrm{opt}} }[/math] does not contain the arcs [math]\displaystyle{ (v_1,w_1),\ldots,(v_k,w_k) }[/math] of [math]\displaystyle{ C' }[/math], and that [math]\displaystyle{ k\gt 1 }[/math]. Since [math]\displaystyle{ B_{\mathrm{opt}} }[/math] is as close as possible to [math]\displaystyle{ B'' }[/math], replacing the incoming arc of any [math]\displaystyle{ (w_i) }[/math] by [math]\displaystyle{ (v_i,w_i) }[/math] in [math]\displaystyle{ B_{\mathrm{opt}} }[/math] and doing nothing else, would yield a result that is not a branching anymore. Since the indegrees do not change, this means that adding [math]\displaystyle{ (v_i,w_i) }[/math] to [math]\displaystyle{ B_{\mathrm{opt}} }[/math] would close cyce. In other words, there is a path [math]\displaystyle{ p_i }[/math] in [math]\displaystyle{ B_{\math{opt}} }[/math] from [math]\displaystyle{ w_i }[/math]
Note that at most one arc of [math]\displaystyle{ B }[/math] points into the super-node. Therefore, [math]\displaystyle{ B'' }[/math] contains all arcs of [math]\displaystyle{ Z }[/math] but exactly one.
Complexity
Statement: The asymptotic complexity is in [math]\displaystyle{ \mathcal{O}((n+m)\cdot n) }[/math] in the worst case, where [math]\displaystyle{ n=|V| }[/math] and [math]\displaystyle{ m=|A| }[/math].
Proof: Using DFS for cycle detection, each recursive step requires [math]\displaystyle{ \mathcal{O}(n+m) }[/math]. In each shrink operation, the number of nodes decreases, so the recursion depth is [math]\displaystyle{ \mathcal{O}(n) }[/math].
Remarks
- The unshrink operation requires that the shrink operation performs some bookkeeping: For the super-node, a cyclically ordered sequence of all nodes and arcs on [math]\displaystyle{ Z }[/math] must probably be maintained.
- Several cycles may be discovered simultaneously by one run of DFS. Note that all cycles in a critical graph are node-disjoint, because no node has more than one incoming arc. Therefore, several cycles may be handled simulaneously, in one recursive call, without any interference.