48
Lecture 16 Maximum Matching

Lecture 16 Maximum Matching

Embed Size (px)

DESCRIPTION

Lecture 16 Maximum Matching. Incremental Method. Transform from a feasible solution to another feasible solution to increase (or decrease) the value of objective function. Matching in Bipartite Graph. Maximum Matching. 1. 1. Note: Every edge has capacity 1. - PowerPoint PPT Presentation

Citation preview

Page 1: Lecture 16  Maximum Matching

Lecture 16

Maximum Matching

Page 2: Lecture 16  Maximum Matching

Incremental Method

• Transform from a feasible solution to another feasible solution to increase (or decrease) the value of objective function.

Page 3: Lecture 16  Maximum Matching

Matching in Bipartite Graph

common.

in endpoint no have edges any twoin which edges of

subset a is matching a ),,,(graph bipartite aGiven EUVG

y.cardinalit maximum

with matching a find ),,(graph bipartite aGiven EVG

Maximum Matching

Page 4: Lecture 16  Maximum Matching
Page 5: Lecture 16  Maximum Matching

1

1

Page 6: Lecture 16  Maximum Matching

Note: Every edge has capacity 1.

Page 7: Lecture 16  Maximum Matching
Page 8: Lecture 16  Maximum Matching
Page 9: Lecture 16  Maximum Matching
Page 10: Lecture 16  Maximum Matching
Page 11: Lecture 16  Maximum Matching
Page 12: Lecture 16  Maximum Matching
Page 13: Lecture 16  Maximum Matching
Page 14: Lecture 16  Maximum Matching
Page 15: Lecture 16  Maximum Matching

2. Can we do those augmentation in the same time?

1. Can we do augmentation directly in bipartite graph?

Page 16: Lecture 16  Maximum Matching

1. Can we do augmentation directly in bipartite graph?

Yes!!!

Page 17: Lecture 16  Maximum Matching

Alternative Path

path. e within thedges matched

and unmatchedbetween alternates and vertex,free aat

ends vertex,free aat startspath that a ispath augmentingAn

vertex.free a called is

matching somein edgean ofendpoint not the ishat A vertex t

M

Page 18: Lecture 16  Maximum Matching

Optimality Condition

path. augmenting no hasit iff maximum is matchingA

. .path w.r.t augmentingan contains *Then

.|*||| with matchings twobe * and Let )(

Trivial. )(

MMM

MMMM

M *M *M

*M

Page 19: Lecture 16  Maximum Matching

*MM *MM

1)(deg vM 2)(deg * vMM1)(deg * vM

Page 20: Lecture 16  Maximum Matching

Puzzle

contain? * does w.r.t.

paths augmentingdisjoint many how ,|||*| If

MMM

kMM

why?,exactly :Answer k

Page 21: Lecture 16  Maximum Matching

Extension to Graph

Page 22: Lecture 16  Maximum Matching

Matching in Graph

common.

in endpoint no have edges any twoin which edges of

subset a is matching a ),,(graph aGiven EVG

y.cardinalit maximum

with matching a find ),,(graph aGiven EVG

Maximum Matching

Page 23: Lecture 16  Maximum Matching

Note

• We cannot transform Maximum Matching in Graph into a maximum flow problem.

• However, we can solve it with augmenting path method.

Page 24: Lecture 16  Maximum Matching

Alternative Path

path. e within thedges matched

and unmatchedbetween alternates and vertex,free aat

ends vertex,free aat startspath that a ispath augmentingAn

vertex.free a called is

matching somein edgean ofendpoint not the ishat A vertex t

M

Page 25: Lecture 16  Maximum Matching

Optimality Condition

path. augmenting no hasit iff maximum is matchingA

. .path w.r.t augmentingan contains *Then

.|*||| with matchings twobe * and Let )(

Trivial. )(

MMM

MMMM

M *M *M

*M

Page 26: Lecture 16  Maximum Matching

2. Can we do those augmentation in the same time?

Page 27: Lecture 16  Maximum Matching

Hopcroft–Karp algorithm

• The Hopcroft–Karp algorithm may therefore be seen as an adaptation of the Edmonds-Karp algorithm for maximum flow.

Page 28: Lecture 16  Maximum Matching

In Each Phase

. to from paths

shortest disjoint ofset maximal find graph, residualIn

ts

s t

least two.at by increasespath

augmentingshortest theoflength thephase,each In

Page 29: Lecture 16  Maximum Matching

Running Time

phases. /2

mostat through from obtained becan * Hence,

/2. is *in paths augmenting of # Thus,

1.2length has themofEach

.for paths augmenting |||*|

contains *Then matching. maximum *

and phase after matching thebe Let

time.)(in excuted becan phaseEach

n

MM

nMM

n

MMM

MMM

nM

mO

|||| EV

Reading Material

Page 30: Lecture 16  Maximum Matching

Max Weighted Matching

Page 31: Lecture 16  Maximum Matching

Maximum Weight Matching

weight.total

maximumis with matching a find ,:weight

edge positive with ),(graph bipartite aGiven

REw

EVG

1

3

?

It is hard to be transformed to maximum flow!!!

Page 32: Lecture 16  Maximum Matching

Minimum Weight Matching

weight. toalmaximumis with matching a find ,:

weight edge enonnegativ with ),(graph aGiven

REc

EVG

Page 33: Lecture 16  Maximum Matching

Augmenting Path

edges. matchedon that edges unmatchedon weight

total with thecycle ealternativan is cycle augmentingAn

edges. matched

on weight total the edges unmatchedon weight total thethat,

propert path with ealternativ maxinal a ispath augmentingAn

vertex.free a called is

matching somein edgean ofendpoint not the ishat A vertex t

M

Page 34: Lecture 16  Maximum Matching

Optimality Condition

. w.r.t.path/cycle augmentingan contains *Then

*).()( with matchings twobe * and Let )(

Trivial. )(

MMM

McMcMM

M *M *M

*M

cycle. augmenting no andpath

augmenting no hasit iffweight -maximum is matchingA

Page 35: Lecture 16  Maximum Matching

35

Page 36: Lecture 16  Maximum Matching

36

Page 37: Lecture 16  Maximum Matching

37

Page 38: Lecture 16  Maximum Matching

38

Page 39: Lecture 16  Maximum Matching

39

Page 40: Lecture 16  Maximum Matching

40

Page 41: Lecture 16  Maximum Matching

41

Page 42: Lecture 16  Maximum Matching

42

Page 43: Lecture 16  Maximum Matching

43

Page 44: Lecture 16  Maximum Matching

44

Page 45: Lecture 16  Maximum Matching

Chinese Postman

distance.

possibleleast with theletters,deliver order toin city ain

roadevery along travel toshesPostman wi Chinese The

once.least at traversedis edge

each in which graph theof walk closedshortest a

find weight,edge enonnegativ graph with aGiven

Page 46: Lecture 16  Maximum Matching
Page 47: Lecture 16  Maximum Matching

Minimum Weight Perfect Matching

• Minimum Weight Perfect Matching can be transformed to Maximum Weight Matching.

• Chinese Postman Problem is equivalent to Minimum Weight Perfect Matching in graph on odd nodes.

Page 48: Lecture 16  Maximum Matching