Download presentation
Presentation is loading. Please wait.
Published byJasmine Jacobs Modified over 9 years ago
1
Matchings Example Freya buys some chocolates to share with her friends. There are six chocolates – raspberry rage (R), truffle tickle (T), nut nibble (N), strawberry supreme (S), walnut whirl (W) and marshmallow melt (M). Of her friends, Ann likes raspberry rage and marshmallow melt; Baz likes strawberry supreme; Carl likes nut nibble and marshmallow melt; Dee likes truffle tickle, nut nibble and walnut whirl; and Ellie likes strawberry supreme and marshmallow melt. Freya herself likes raspberry rage, truffle tickle and strawberry supreme. Can they each have a chocolate they like?
2
Matchings Bipartite graphs We can represent this situation using a bipartite graph. This is a graph with two distinct sets; the friends and the chocolates. The edges only go from a vertex in one set to a vertex in the other; in this case where the person likes that particular chocolate. Ana Baz Carl Dee Ellie Freya R. raspberry rage T. truffle tickle N. nut nibble S. strawberry supreme W. walnut whirl M. marshmallow melt Anna likes raspberry rage and marshmallow melt Baz likes strawberry supreme Carl likes nut nibble and marshmallow melt Dee likes truffle tickle, nut nibble and walnut whirl Ellie likes strawberry supreme and marshmallow melt Freya likes raspberry rage, truffle tickle and strawberry supreme
3
Initial Matching If we now pair people with particular chocolates they like in a one-to-one way (no two people to the same chocolate, no two chocolates to one person) then we have a matching. If a matching includes the same number of edges as vertices in each set (6 in this case) then it is called a complete matching. The diagram shows the matching A-R, B-S, C-N, D-T, E-M THIS MATCHING IS NOT COMPLETE If a matching includes the same number of edges as vertices in each set (6 in this case) then it is called a complete matching. The diagram shows the matching A-R, B-S, C-N, D-T, E-M THIS MATCHING IS NOT COMPLETE A B C D E F R. T. N. S. W. M.
4
Matchings Alternating paths If we have a matching and want to improve it we can do so by finding an alternating path. This is a path which (a) Starts on an unmatched vertex on the right hand side [W] (b) Consists of edges alternately not in and in the matching (c) Finishes on an unmatched vertex in the second set If we have a matching and want to improve it we can do so by finding an alternating path. This is a path which (a) Starts on an unmatched vertex on the right hand side [W] (b) Consists of edges alternately not in and in the matching (c) Finishes on an unmatched vertex in the second set Start with W join to W to D Now remove D-T T now has no match so include T-F F was previously unmatched, so we have now have breakthrough. The alternating path is W-D-T-F Every vertex is now matched so we have a complete matching Start with W join to W to D Now remove D-T T now has no match so include T-F F was previously unmatched, so we have now have breakthrough. The alternating path is W-D-T-F Every vertex is now matched so we have a complete matching A B C D E F R. T. N. S. W. M.
5
Matchings Alternating paths The solution consists of 1. Edges in the alternating path but not in the initial matching; D-W and F-T 2. Edges in the initial matching but not in the alternating path; A-R, B-S, C-N and E-M The solution consists of 1. Edges in the alternating path but not in the initial matching; D-W and F-T 2. Edges in the initial matching but not in the alternating path; A-R, B-S, C-N and E-M Interpretation: Ann has raspberry rage Baz has strawberry supreme Carl had nut nibble Dee has walnut whirl Ellie has marshmallow melt Freya has truffle tickle. Interpretation: Ann has raspberry rage Baz has strawberry supreme Carl had nut nibble Dee has walnut whirl Ellie has marshmallow melt Freya has truffle tickle. A B C D E F R. T. N. S. W. M.
6
Student Jobs Matching
13
Past Exam Qu.s June 2005
14
Past Exam Qu.s Jan 2004
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.