Algorithms - Lecture 10 - Minimum cost perfect matching

本文详细介绍了求解最小成本完美匹配问题的算法。首先定义了匹配的概念和完美匹配的性质,特别是在二分图中。接着,提出了残余图的概念,通过增广路径和交替环来寻找匹配的优化路径。然后,讨论了交替环如何对应于残余图中的简单有向环,并指出没有负成本循环是完美匹配的特征。最后,引入了顶点价格和减少成本的概念,确保了算法中所有边的减少成本都是非负的。整个过程基于迭代框架,通过找到增广路径不断更新匹配,直到达到最小成本的完美匹配状态。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1 Definition

  • A matching is a set of edges without common vertices. Or, each vertex has a degree ≤ 1 \leq 1 1.
  • G = ( V , E ) G=(V,E) G=(V,E) is a bipartite graph that does not contain any odd-length cycles.
    • Assume V V V can be partitioned in to X X X and Y Y Y, such that ∣ X ∣ = ∣ Y ∣ = n |X|=|Y|=n X=Y=n, and each edge has one endpoint in X X X and one endpoint in Y Y Y.
    • Assume G G G admits a perfect matching, i.e., a matching of cardinality n n n.
  • Want to compute a minimum-cost perfect matching of G G G.

2 Algorithm

2.1 Residual graph

Definition of residual graph G M G_M GM

G M G_M GM is V ∪ { s , t } V \cup \{s,t\} V{s,t}, for each vertex x x x in X X X

  • if x x x is not matched in M M M, add directed edge ( s , x ) (s,x) (s,x) with cost zero
  • if y y y is not matched in M M M, add directed edge ( y , t ) (y,t) (y,t) with cost zero
  • for each edge e = ( x , y ) ∈ M e=(x,y)\in M e=(x,y)M, G M G_M GM contains a directed edge from y y y to x x x with cost − c e -c_e ce
  • for each edge e = ( x , y ) ∈ E / M e=(x,y)\in E/M e=(x,y)E/M, G M G_M GM contains a directed edge from x x x to y y y with cost c e c_e ce

Augmenting paths - Simple directed paths in G M G_M GM

  • There is a one-to-one correspondence between (simple) directed s − t s-t st paths in G M G_M GM and augmenting paths in G G G w.r.t. M M M.
    • Let M ′ M' M be a perfect matching of G G G.
    • M ⊕ M ′ M\oplus M' MM corresponds to a collection of vertex-disjoint alternating paths and cycles in G G G. (it’s easy to see that the symmetric difference induces degree at most 2 on any vertex. And a graph with degree at most 2 has a very simple structure; it can only contain paths and cycles.)
    • Since ∣ M ′ ∣ > ∣ M ∣ |M'|>|M| M>M, this collection includes an augmenting path P P P in G G G w.r.t. M M M.

2.2 Alternating cycles

Simple directed cycles in G M G_M GM - Alternating cycles in G G G

There is one-to-one correspondence between simple directed cycles in G M G_M GM and alternating cycles in G G G w.r.t. perfect matching M M M.

Characterizing Minimum-Cost perfect matchings

M M M is a perfect matching of G G G ↔ \leftrightarrow no negative-cost cycle in G M G_M GM.

Since each vertex is matched in two perfect matchings M , M ′ M,M' M,M, thus the symmetric difference M ⊕ M ′ M\oplus M' MM result in that each vertex has a degree in {0,2}, thus there cannot be paths (since the beginning and end of vertex of a path has a degree=1).

2.3 Vertex prices and Reduced costs in G M G_M GM

Definition

  • Maintain a price p ( v ) p(v) p(v) for each vertex v v v in V + s V+s V+s
  • For each edge in G M G_M GM not incident on t t t
    • Each directed edge ( s , x ) (s,x) (s,x) is assigned a reduced cost p ( s ) − p ( x ) p(s)-p(x) p(s)p(x)
    • For each edge e = ( x , y ) e=(x,y) e=(x,y)
      • if e = ( x , y ) ∈ G M e=(x,y) \in G_M e=(x,y)GM, reduced cost = c e + p ( x ) − p ( y ) =c_e+p(x)-p(y) =ce+p(x)p(y)
      • if e = ( y , x ) ∈ G M e=(y,x) \in G_M e=(y,x)GM, reduced cost = − c e + p ( y ) − p ( x ) =-c_e+p(y)-p(x) =ce+p(y)p(x)

Nonnegative reduced costs

  • G M G_M GM does not contain any negative-cost directed cycles
  • Use Dijkstra’s SSSP algorithm to compute minimum-cost s-t path in G M G_M GM

2. Iterative framework

  • From M i M_i Mi to M i + 1 M_{i+1} Mi+1, identify an augmenting path P i P_i Pi and set M i + 1 = M i ⊕ P i M_{i+1}=M_i \oplus P_i Mi+1=MiPi.
    • P i P_i Pi is a simple path in G G G of odd length, with one endpoint in X X X and the other endpoint in Y Y Y.
    • Edges of P i P_i Pi alternate between edges in M i M_i Mi and edges not in M i M_i Mi.
    • Neither endpoint is matched in M i M_i Mi, so P i P_i Pi begins and ends with an edge that is not in M i M_i Mi.
  • The cost of M i + 1 M_{i+1} Mi+1 is equal to the cost of M i M_i Mi plus the cost of s → t s\rightarrow t st of P i P_i Pi in G M G_M GM.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值