Skip to Content
算法技术手册(原书第2 版)
book

算法技术手册(原书第2 版)

by George T.Heineman, Gary Pollice, Stanley Selkow
August 2017
Intermediate to advanced
360 pages
8h 35m
Chinese
China Machine Press
Content preview from 算法技术手册(原书第2 版)
220
8
的最大配对数目。算法保证不存在更多的匹配数(虽然有可能会有其他匹配方式能够
得到同样多的匹配数目)。
8.3.2 解决方案
我们将二分图匹配问题归约成最大流问题,而并没有重新设计一个新的算法。在二分图
匹配中,从元素集
S
和参与者集合
T
中选择了匹配(
s
i
,
t
j
)之后,
s
i
或者
t
j
就不能被其他
匹配选择。我们使用
n
表示集合
S
的大小,
m
表示集合
T
的大小。为了在流网络图中产
生同样的行为,我们可以按照如下方法来构建图
G
= (
V
,
E
)
V
包含
n + m + 2
个顶点
每个元素
s
i
映射为号为
i
的顶点,每个参与者映射为号为
n
+
j
的顶点。创建一个
新的源顶点
src
(编号为
0
)和一个新的汇点
tgt
(编号为
n
+
m
+ 1
)。
E
包含
n + m + k
条边
在新的
src
顶点到
S
映射过来的顶点之间添加
n
条边,并在新的
tgt
顶点到从
T
射过来的顶点之间添加
m
条边。对于
k
对匹配中的每一对匹配
p
k
= (
s
i
,
t
j
)
,添加边(
i
,
n
+
j
)。所有边的容量都必须为
1
在流网络图
G
中计算出的最大流就是原始二分图匹配问题中的最大匹配集合,这已经过
证明(
Cormen
等,
2009
)。例如,考虑图
8-6a
中两对匹配
(
a
,
z
)
(
b
,
y
)
组成的最大匹
配集合,依照上述过程构造的流网络如图
8-6b
所示,其中
1
号顶点对应
a
4
号顶点对应
x
以此类推。我们可以进一步改善解决方案来选择三对匹配:
(
a
,
z
)
(
c
,
y
)
(
b
,
x
)
。在找
到一条增广路
<0, 3, 5, 2, 4, 7>
之后,算法会对流网络进行相应的调整。应用增广路径 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

机器学习实战:基于Scikit-Learn、Keras 和TensorFlow (原书第2 版)

机器学习实战:基于Scikit-Learn、Keras 和TensorFlow (原书第2 版)

Aurélien Géron
Go语言编程

Go语言编程

威廉·肯尼迪

Publisher Resources

ISBN: 9787111562221