Branching by Edmonds: Difference between revisions

From Algowiki
Jump to navigation Jump to search
(Created page with "== Abstract view == '''Definition:''' # An arc <math>(v,w)\in A</math> is '''critical''' if its weight is not smaller than the weight of any other arc into <math>w</math>. #...")
 
Line 29: Line 29:
# For every arc <math>(v,w)\in A</math> pointing from some node <math>v</math> outside <math>Z</math> to some node <math>w</math> on <math>Z</math>: Increase the weight of <math>(v,w)</math> by <math>W-w(v',w)</math>, where <math>(v',w)</math> is the arc on <math>Z</math> that points into <math>w</math>.
# For every arc <math>(v,w)\in A</math> pointing from some node <math>v</math> outside <math>Z</math> to some node <math>w</math> on <math>Z</math>: Increase the weight of <math>(v,w)</math> by <math>W-w(v',w)</math>, where <math>(v',w)</math> is the arc on <math>Z</math> that points into <math>w</math>.
# Shrink <math>Z</math> into one new super-node, where every arc pointing to (resp., from)  some node on <math>Z</math> now points to (from) that super-node.
# Shrink <math>Z</math> into one new super-node, where every arc pointing to (resp., from)  some node on <math>Z</math> now points to (from) that super-node.
# Call the algorithm recursively for the modified weighted graph after shrinking.
# Call the algorithm recursively for the modified weighted graph after shrinking, giving branching <math>B</math>.
# Unshrink the graph.
# Unshrink the graph.
# Add all arcs of <math>Z</math> to <math>B</math> giving <math>B'</math>.
# If <math>B</math> contains an arc <math>(v,w)</math> such that <math>v</math> is outside <math>Z</math> and <math>w</math> is on <math>Z</math>: remove the incoming arc of <math>w</math> on <math>Z</math> from <math>B</math>, otherwise, remove one arc with weight <math>W</math> on <math>Z</math>. Let <math>B''</math> be the result.
# Return <math>B</math>.


'''Proof:'''
Obviously, <math>B''</math> is a branching, so we have to prove that is optimal given that the branching obtained from the recursive call is optimal for the shrunken graph. Let <math>B'''</math> be a maximum branching in <math>G</math> such that, among all maximum branchings in <math>B</math>, <math>B'''</math> shares as many arcs as possible with <math>B''</math>. We have to show <math>B'''=B''</math>


Note that at most one arc of <math>B</math> points into the super-node. Therefore, <math>B''</math> contains all arcs of <math>Z</math> but exactly one.


== Correctness ==
== Correctness ==

Revision as of 18:08, 9 October 2014

Abstract view

Definition:

  1. An arc [math]\displaystyle{ (v,w)\in A }[/math] is critical if its weight is not smaller than the weight of any other arc into [math]\displaystyle{ w }[/math].
  2. A critical subgraph of [math]\displaystyle{ G }[/math] consists of all nodes of [math]\displaystyle{ G }[/math] and of a maximum number of critical 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.

Basis operation in each recursiv step: compute a critical graph.


Induction basis

Abstract view: Terminate if the critical graph is cycle-free.

Proof: If a critical graph [math]\displaystyle{ C }[/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 weight than [math]\displaystyle{ C }[/math].

Obviously, 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{ C }[/math] pointing to the same node. Due to the choice of arcs for [math]\displaystyle{ C }[/math], it is [math]\displaystyle{ w(a)\leq w(a') }[/math].


Induction step

Abstract view:

  1. Identify one cycle [math]\displaystyle{ Z }[/math] in the computed critical graph.
  2. Let [math]\displaystyle{ W }[/math] denote the minimum weight of all arcs on [math]\displaystyle{ Z }[/math].
  3. 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]: Increase the weight of [math]\displaystyle{ (v,w) }[/math] by [math]\displaystyle{ W-w(v',w) }[/math], where [math]\displaystyle{ (v',w) }[/math] is the arc on [math]\displaystyle{ Z }[/math] that points into [math]\displaystyle{ w }[/math].
  4. 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.
  5. Call the algorithm recursively for the modified weighted graph after shrinking, giving branching [math]\displaystyle{ B }[/math].
  6. Unshrink the graph.
  7. Add all arcs of [math]\displaystyle{ Z }[/math] to [math]\displaystyle{ B }[/math] giving [math]\displaystyle{ B' }[/math].
  8. 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.
  9. Return [math]\displaystyle{ B }[/math].

Proof: Obviously, [math]\displaystyle{ B'' }[/math] is a branching, so we have to prove that is optimal given that the branching obtained from the recursive call is optimal for the shrunken graph. Let [math]\displaystyle{ B''' }[/math] be a maximum branching in [math]\displaystyle{ G }[/math] such that, among all maximum branchings in [math]\displaystyle{ B }[/math], [math]\displaystyle{ B''' }[/math] shares as many arcs as possible with [math]\displaystyle{ B'' }[/math]. We have to show [math]\displaystyle{ B'''=B'' }[/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.

Correctness

Complexity

Remarks

  1. 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.
  2. 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.