|
|
Line 1: |
Line 1: |
| In the [[mathematics|mathematical]] discipline of [[graph theory]], a '''matching''' or '''independent edge set''' in a [[graph (mathematics)|graph]] is a set of [[Edge (graph theory)|edges]] without common [[vertex (graph theory)|vertices]]. It may also be an entire graph consisting of edges without common vertices.
| | [http://Www.Roberto.net/ Roberto] is the name I just love to be generally known as with though I generally really like being categorised as like that. My friends say it's not really for me but the I love doing is definitely to bake but My organization is thinking on starting interesting things. South Carolina is where simple home is. Software developing is how My spouse and i support my family. You can find my website here: http://circuspartypanama.com<br><br>Also visit my homepage ... clash of clans hack no survey ([http://circuspartypanama.com mouse click the up coming internet site]) |
| | |
| {{Covering-Packing_Problem_Pairs}}
| |
| | |
| == Definition ==
| |
| | |
| Given a [[graph (mathematics)|graph]] ''G'' = (''V'',''E''), a '''matching''' ''M'' in ''G'' is a set of pairwise [[non-adjacent]] edges; that is, no two edges share a common vertex.
| |
| | |
| A vertex is '''matched''' (or '''saturated''') if it is an endpoint of one of the edges in the matching. Otherwise the vertex is '''unmatched'''.
| |
| | |
| A '''maximal matching''' is a matching ''M'' of a graph ''G'' with the property that if any edge not in ''M'' is added to ''M'', it is no longer a matching, that is, ''M'' is maximal if it is not a proper subset of any other matching in graph ''G''. In other words, a matching ''M'' of a graph ''G'' is maximal if every edge in ''G'' has a non-empty intersection with at least one edge in ''M''. The following figure shows examples of maximal matchings (red) in three graphs.
| |
| | |
| :[[File:Maximal-matching.svg]] | |
| | |
| A '''maximum matching''' (also known as maximum-cardinality matching<ref>Alan Gibbons, Algorithmic Graph Theory, Cambridge University Press, 1985, Chapter 5.</ref>) is a matching that contains the largest possible number of edges. There may be many maximum matchings. The '''matching number''' <math>\nu(G)</math> of a graph <math>G</math> is the size of a maximum matching. Note that every maximum matching is maximal, but not every maximal matching is a maximum matching. The following figure shows examples of maximum matchings in the same three graphs.
| |
| | |
| :[[File:Maximum-matching-labels.svg]]
| |
| | |
| A '''perfect matching''' (a.k.a. [[1-factor]]) is a matching which matches all vertices of the graph. That is, every vertex of the graph is [[incidence (geometry)|incident]] to exactly one edge of the matching. Figure (b) above is an example of a perfect matching. Every perfect matching is maximum and hence maximal. In some literature, the term '''complete matching''' is used. In the above figure, only part (b) shows a perfect matching. A perfect matching is also a minimum-size [[edge cover]]. Thus, {{math|<var>ν(G) ≤ ρ(G) </var>}}, that is, the size of a maximum matching is no larger than the size of a minimum edge cover.
| |
| | |
| A '''near-perfect matching''' is one in which exactly one vertex is unmatched. This can only occur when the graph has an [[odd number]] of vertices, and such a matching must be maximum. In the above figure, part (c) shows a near-perfect matching. If, for every vertex in a graph, there is a near-perfect matching that omits only that vertex, the graph is also called [[factor-critical graph|factor-critical]].
| |
| | |
| Given a matching ''M'',
| |
| * an '''alternating path''' is a path in which the edges belong alternatively to the matching and not to the matching.
| |
| * an '''augmenting path''' is an alternating path that starts from and ends on free (unmatched) vertices.
| |
| | |
| One can prove that a matching is maximum if and only if it does not have any augmenting path. (This result is sometimes called [[Berge's lemma]].)
| |
| | |
| == Properties ==
| |
| | |
| In any graph without isolated vertices, the sum of the matching number and the [[edge covering number]] equals the number of vertices.<ref>{{citation|last=Gallai|first=Tibor|title=Über extreme Punkt- und Kantenmengen|journal=Ann. Univ. Sci. Budapest. Eötvös Sect. Math. |volume=2|pages=133–138|year=1959}}.</ref> If there is a perfect matching, then both the matching number and the edge cover number are |''V''| / 2.
| |
| | |
| If ''A'' and ''B'' are two maximal matchings, then |''A''| ≤ 2|''B''| and |''B''| ≤ 2|''A''|. To see this, observe that each edge in ''B'' \ ''A'' can be adjacent to at most two edges in ''A'' \ ''B'' because ''A'' is a matching; moreover each edge in ''A'' \ ''B'' is adjacent to an edge in ''B'' \ ''A'' by maximality of ''B'', hence
| |
| | |
| :<math>|A \setminus B| \le 2|B \setminus A|.</math>
| |
| | |
| Further we get that
| |
| | |
| :<math>|A| = |A \cap B| + |A \setminus B| \le 2|B \cap A| + 2|B \setminus A| = 2|B|.</math>
| |
| | |
| In particular, this shows that any maximal matching is a 2-approximation of a maximum matching and also a 2-approximation of a minimum maximal matching. This inequality is tight: for example, if ''G'' is a path with 3 edges and 4 nodes, the size of a minimum maximal matching is 1 and the size of a maximum matching is 2.
| |
| | |
| == Matching polynomials ==
| |
| {{main|Matching polynomial}}
| |
| A [[generating function]] of the number of ''k''-edge matchings in a graph is called a matching polynomial. Let ''G'' be a graph and ''m<sub>k</sub>'' be the number of ''k''-edge matchings. One matching polynomial of ''G'' is
| |
| :<math>\sum_{k\geq0} m_k x^k.</math>
| |
| Another definition gives the matching polynomial as
| |
| :<math>\sum_{k\geq0} (-1)^k m_k x^{n-2k},</math>
| |
| where ''n'' is the number of vertices in the graph. Each type has its uses; for more information see the article on matching polynomials.
| |
| | |
| == Algorithms and computational complexity ==
| |
| | |
| === In unweighted bipartite graphs ===
| |
| | |
| Matching problems are often concerned with [[bipartite graph]]s. Finding a '''maximum bipartite matching'''<ref name="Wes01">{{citation
| |
| | last = West
| |
| | first = Douglas Brent
| |
| | edition = 2nd
| |
| | year = 1999
| |
| | title = Introduction to Graph Theory
| |
| | at = Chapter 3
| |
| | publisher = Prentice Hall
| |
| | isbn = 0-13-014400-2}}</ref>
| |
| (often called a '''maximum cardinality bipartite matching''') in a bipartite graph <math>G=(V=(X,Y),E)</math> is perhaps the simplest problem.
| |
| | |
| The [[Augmenting path algorithm]] finds it by finding an augmenting path from each {{math|<var>x ∈ X</var>}} to <math>\ Y</math> and adding it to the matching if it exists. As each path can be found in <math>\ O(E)</math> time, the running time is <math>\ O(V E)</math>. This solution is equivalent to adding a ''super source'' <math>s</math> with edges to all vertices in <math>\ X</math>, and a ''super sink'' <math>\ t</math> with edges from all vertices in <math>\ Y</math>, and finding a [[maximum flow problem|maximal flow]] from <math>\ s</math> to <math>\ t</math>. All edges with flow from <math>\ X</math> to <math>\ Y</math> then constitute a maximum matching.
| |
| | |
| An improvement over this is the [[Hopcroft–Karp algorithm]], which runs in <math>O(\sqrt{V}E)</math> time. Another approach is based on the fast [[matrix multiplication]] algorithm and gives <math>O(V^{2.376})</math> complexity,<ref name="Mucha">{{citation
| |
| | last1 = Mucha | first1 = M.
| |
| | last2 = Sankowski | first2 = P.
| |
| | contribution = Maximum Matchings via Gaussian Elimination
| |
| | url = http://www.mimuw.edu.pl/~mucha/pub/mucha_sankowski_focs04.pdf
| |
| | pages = 248–255
| |
| | title = [[Symposium on Foundations of Computer Science|Proc. 45th IEEE Symp. Foundations of Computer Science]]
| |
| | year = 2004}}</ref> which is better in theory for sufficiently [[dense graph]]s, but in practice the algorithm is slower.
| |
| | |
| === In weighted bipartite graphs ===
| |
| In a [[weighted graph|weighted]] bipartite graph, each edge has an associated value. A '''maximum weighted bipartite matching'''<ref name="Wes01" /> is defined as a matching where the sum of the values of the edges in the matching have a maximal value. If the graph is not [[Complete bipartite graph|complete bipartite]], missing edges are inserted with value zero. Finding such a matching is known as the [[assignment problem]]. The remarkable [[Hungarian algorithm]] solves the assignment problem and it was one of the beginnings of combinatorial optimization algorithms. It uses a modified [[shortest path]] search in the augmenting path algorithm. If the [[Bellman–Ford algorithm]] is used for this step, the running time of the Hungarian algorithm becomes <math>O(V^2 E)</math>, or the edge cost can be shifted with a potential to achieve <math>O(V^2 \log{V} + V E)</math> running time with the [[Dijkstra algorithm]] and [[Fibonacci heap]].<ref name="Fredman87">{{citation
| |
| | last1 = Fredman | first1 = Michael L.
| |
| | last2 = Tarjan | first2 = Robert Endre
| |
| | doi = 10.1145/28869.28874
| |
| | issue = 3
| |
| | journal = [[Journal of the ACM]]
| |
| | pages = 596–615
| |
| | title = Fibonacci heaps and their uses in improved network optimization algorithms
| |
| | volume = 34
| |
| | year = 1987}}</ref>
| |
| | |
| === In general graphs ===
| |
| {{Main|Edmonds's matching algorithm}}
| |
| There is a polynomial time algorithm to find a maximum matching or a maximum weight matching in a graph that is not bipartite; it is due to [[Jack Edmonds]], is called the ''paths, trees, and flowers'' method or simply [[Edmonds's matching algorithm|Edmonds's algorithm]], and uses [[bidirected graph|bidirected edges]]. A generalization of the same technique can also be used to find [[maximum independent set]]s in [[claw-free graph]]s. Edmonds' algorithm has subsequently been improved to run in time {{math|<var>O</var>({{radical|<var>V</var>}}<var>E</var>)}} time, matching the time for bipartite maximum matching.<ref>{{citation
| |
| | last1 = Micali | first1 = S. | author1-link = Silvio Micali
| |
| | last2 = Vazirani | first2 = V. V. | author2-link = Vijay Vazirani
| |
| | contribution = An <math>\scriptstyle O(\sqrt{|V|}\cdot|E|)</math> algorithm for finding maximum matching in general graphs
| |
| | doi = 10.1109/SFCS.1980.12
| |
| | pages = 17–27
| |
| | title = [[Symposium on Foundations of Computer Science|Proc. 21st IEEE Symp. Foundations of Computer Science]]
| |
| | year = 1980}}.</ref>
| |
| | |
| Another (randomized) algorithm by Mucha and Sankowski,<ref name="Mucha" /> based on the fast [[matrix multiplication]] algorithm, gives <math>O(V^{2.376})</math> complexity.
| |
| | |
| === Maximal matchings ===
| |
| | |
| A maximal matching can be found with a simple greedy algorithm. A maximum matching is also a maximal matching, and hence it is possible to find a ''largest'' maximal matching in polynomial time. However, no polynomial-time algorithm is known for finding a '''minimum maximal matching''', that is, a maximal matching that contains the ''smallest'' possible number of edges.
| |
| | |
| Note that a maximal matching with ''k'' edges is an [[edge dominating set]] with ''k'' edges. Conversely, if we are given a minimum edge dominating set with ''k'' edges, we can construct a maximal matching with ''k'' edges in polynomial time. Therefore the problem of finding a minimum maximal matching is essentially equal to the problem of finding a minimum edge dominating set.<ref>{{citation
| |
| | first1=Mihalis | last1=Yannakakis
| |
| | first2=Fanica | last2=Gavril
| |
| | title=Edge dominating sets in graphs
| |
| | journal=SIAM Journal on Applied Mathematics
| |
| | year=1980
| |
| | volume=38
| |
| | pages=364–372
| |
| | doi=10.1137/0138030
| |
| | issue=3
| |
| }}.</ref> Both of these two optimisation problems are known to be [[NP-hard]]; the decision versions of these problems are classical examples of [[NP-complete]] problems.<ref>{{citation
| |
| | last1=Garey | first1=Michael R. | authorlink1=Michael R. Garey
| |
| | last2=Johnson | first2=David S. | authorlink2=David S. Johnson
| |
| | year = 1979
| |
| | title = [[Computers and Intractability: A Guide to the Theory of NP-Completeness]]
| |
| | publisher = W.H. Freeman
| |
| | isbn=0-7167-1045-5
| |
| }}. Edge dominating set (decision version) is discussed under the dominating set problem, which is the problem GT2 in Appendix A1.1. Minimum maximal matching (decision version) is the problem GT10 in Appendix A1.1.</ref> Both problems can be [[approximation algorithm|approximated]] within factor 2 in polynomial time: simply find an arbitrary maximal matching ''M''.<ref>{{citation
| |
| | last1=Ausiello | first1=Giorgio
| |
| | last2=Crescenzi | first2=Pierluigi
| |
| | last3=Gambosi | first3=Giorgio
| |
| | last4=Kann | first4=Viggo
| |
| | last5=Marchetti-Spaccamela | first5=Alberto
| |
| | last6=Protasi | first6=Marco
| |
| | title=Complexity and Approximation: Combinatorial Optimization Problems and Their Approximability Properties
| |
| | publisher=Springer
| |
| | year=2003
| |
| }}. Minimum edge dominating set (optimisation version) is the problem GT3 in Appendix B (page 370). Minimum maximal matching (optimisation version) is the problem GT10 in Appendix B (page 374). See also [http://www.nada.kth.se/~viggo/wwwcompendium/node13.html Minimum Edge Dominating Set] and [http://www.nada.kth.se/~viggo/wwwcompendium/node21.html Minimum Maximal Matching] in the [http://www.nada.kth.se/~viggo/wwwcompendium/ web compendium].</ref>
| |
| | |
| === Counting problems ===
| |
| {{main|Hosoya index}}
| |
| The number of matchings in a graph is known as the [[Hosoya index]] of the graph. It is [[Sharp-P-complete|#P-complete]] to compute this quantity. It remains #P-complete in the special case of counting the number of perfect matchings in a given [[bipartite graph]], because computing the [[permanent]] of an arbitrary 0–1 matrix (another #P-complete problem) is the same as computing the number of perfect matchings in the bipartite graph having the given matrix as its [[biadjacency matrix]]. However, there exists a fully polynomial time randomized approximation scheme for counting the number of bipartite matchings.<ref>{{cite journal
| |
| | last1 = Bezáková
| |
| | first1 = Ivona
| |
| | last2 = Štefankovič
| |
| | first2 = Daniel
| |
| | last3 = Vazirani
| |
| | first3 = Vijay V.
| |
| | authorlink3 = Vijay Vazirani
| |
| | last4 = Vigoda
| |
| | first4 = Eric
| |
| | year = 2008
| |
| | title = Accelerating Simulated Annealing for the Permanent and Combinatorial Counting Problems
| |
| | journal = [[SIAM Journal on Computing]]
| |
| | volume = 37
| |
| | issue = 5
| |
| | pages = 1429–1454
| |
| | doi = 10.1137/050644033
| |
| }}</ref> A remarkable theorem of [[Pieter Kasteleyn|Kasteleyn]] states that the number of perfect matchings in a [[planar graph]] can be computed exactly in polynomial time via the [[FKT algorithm]].
| |
| | |
| The number of perfect matchings in a [[complete graph]] ''K''<sub>''n''</sub> (with ''n'' even) is given by the [[double factorial]] (''n'' − 1)!!.<ref>{{citation|title=A combinatorial survey of identities for the double factorial|first=David|last=Callan|arxiv=0906.1317|year=2009}}.</ref> The numbers of matchings in complete graphs, without constraining the matchings to be perfect, are given by the [[Telephone number (mathematics)|telephone number]]s.<ref>{{citation
| |
| | last1 = Tichy | first1 = Robert F.
| |
| | last2 = Wagner | first2 = Stephan
| |
| | doi = 10.1089/cmb.2005.12.1004
| |
| | issue = 7
| |
| | journal = [[Journal of Computational Biology]]
| |
| | pages = 1004–1013
| |
| | title = Extremal problems for topological indices in combinatorial chemistry
| |
| | url = http://www.math.tugraz.at/fosp/pdfs/tugraz_main_0052.pdf
| |
| | volume = 12
| |
| | year = 2005}}.</ref>
| |
| | |
| === Finding all maximally-matchable edges ===
| |
| One of the basic problems in matching theory is to find in a given graph all edges that may be extended to a maximum matching
| |
| in the graph. (Such edges are called '''maximally-matchable''' edges, or '''allowed''' edges.) The best deterministic algorithm for solving this problem in general graphs runs in time <math>O(VE)</math>
| |
| .<ref>{{citation
| |
| | first1=Marcelo H.| last1=de Carvalho | first2=Joseph| last2=Cheriyan | contribution=An <math>O(VE)</math> algorithm for ear decompositions of matching-covered graphs
| |
| | title=Proc. ACM/SIAM Symposium on Discrete Algorithms (SODA)
| |
| | year=2005
| |
| | pages=415–423 }}.</ref>
| |
| There exists a randomized algorithm that solves this problem in time <math>\tilde{O}(V^{2.376}) </math>
| |
| .<ref>{{citation
| |
| | first1=Michael O. | last1=Rabin
| |
| | first2=Vijay V. | last2=Vazirani | title=Maximum matchings in general graphs through randomization | journal=J. of Algorithms
| |
| | year=1989 | volume=10
| |
| | pages=557–567 }}.</ref>
| |
| In the case of bipartite graphs, it is possible to find a single maximum matching and then use it in order to find all
| |
| maximally-matchable edges in linear time;<ref>{{citation
| |
| | first1=Tamir | last1=Tassa | title=Finding all maximally-matchable edges in a bipartite graph| year=2012 | journal=[[Theoretical Computer Science (journal)|Theoretical Computer Science]] | volume = 423 | pages = 50–58 | doi = 10.1016/j.tcs.2011.12.071}}.</ref>
| |
| the resulting overall runtime is <math>O(V^{1/2}E)</math> for general bipartite
| |
| graphs and <math>O((V/\log V)^{1/2}E)</math> for dense bipartite graphs with <math>E=\Theta(V^2)</math>. In cases where
| |
| one of the maximum matchings is known upfront,<ref>{{citation
| |
| | first1=Aris| last1=Gionis | first2=Arnon| last2=Mazza | first3=Tamir |last3=Tassa | contribution=''k''-Anonymization revisited
| |
| | title=[[International Conference on Data Engineering (ICDE)]]
| |
| | year=2008
| |
| | pages=744–753}}.</ref> the overall runtime of the algorithm is <math>O(V+E)</math>.
| |
| | |
| == Characterizations and notes ==
| |
| | |
| [[König's theorem (graph theory)|König's theorem]] states that, in bipartite graphs, the maximum matching is equal in size to the minimum [[vertex cover]]. Via this result, the minimum vertex cover, [[maximum independent set]], and [[maximum vertex biclique]] problems may be solved in [[polynomial time]] for bipartite graphs.
| |
| | |
| The [[marriage theorem]] (or Hall's Theorem) provides a characterization of bipartite graphs which have a perfect matching and the [[Tutte theorem]] provides a characterization for arbitrary graphs.
| |
| | |
| A perfect matching is a spanning [[Regular graph|1-regular]] subgraph, a.k.a. a [[1-factor]]. In general, a spanning ''k''-regular subgraph is a [[Factor (graph theory)|''k''-factor]].
| |
| | |
| == Applications ==
| |
| | |
| A '''Kekulé structure''' of an [[Aromaticity|aromatic compound]] consists of a perfect matching of its [[skeletal formula|carbon skeleton]], showing the locations of [[double bond]]s in the [[chemical structure]]. These structures are named after [[Friedrich August Kekulé von Stradonitz]], who showed that [[benzene]] (in graph theoretical terms, a 6-vertex cycle) can be given such a structure.<ref>See, e.g., {{citation|title=On some solved and unsolved problems of [[chemical graph theory]]|last1=Trinajstić|first1=Nenad|authorlink=Nenad Trinajstić|last2=Klein|first2=Douglas J.|last3=Randić|first3=Milan |authorlink3=Milan Randić|journal=International Journal of Quantum Chemistry|year=1986|volume=30|issue=S20|pages=699–742|doi=10.1002/qua.560300762}}.</ref>
| |
| | |
| The [[Hosoya index]] is the number of non-empty matchings plus one; it is used in [[computational chemistry]] and [[mathematical chemistry]] investigations for organic compounds.
| |
| | |
| == See also ==
| |
| * [[Dulmage–Mendelsohn decomposition]], a partition of the vertices of a bipartite graph into subsets such that each edge belongs to a perfect matching if and only if its endpoints belong to the same subset
| |
| * [[Edge coloring]], a partition of the edges of a graph into matchings
| |
| * [[Matching preclusion]], the minimum number of edges to delete to prevent a perfect matching from existing
| |
| * [[Skew-symmetric graph]], a type of graph that can be used to model alternating path searches for matchings
| |
| * [[Stable matching]], a matching in which no two elements prefer each other to their matched partners
| |
| * [[Vertex independent set]], a set of vertices (rather than edges) no two of which are adjacent to each other
| |
| | |
| == References ==
| |
| {{Reflist|2}}
| |
| | |
| == Further reading ==
| |
| #{{Citation
| |
| | author1 = László Lovász
| |
| | authorlink1 = László Lovász
| |
| | author2 = M. D. Plummer | author2-link = Michael D. Plummer
| |
| | title = Matching Theory
| |
| | publisher = North-Holland
| |
| | year = 1986
| |
| | isbn = 0-444-87916-1
| |
| }}
| |
| #{{Citation
| |
| | author = [[Thomas H. Cormen]], [[Charles E. Leiserson]], [[Ronald L. Rivest]] and [[Clifford Stein]]
| |
| | title = [[Introduction to Algorithms]]
| |
| | publisher = MIT Press and McGraw–Hill
| |
| | year = 2001
| |
| | isbn = 0-262-53196-8
| |
| | edition = second
| |
| | at = Chapter 26, pp. 643–700
| |
| }}
| |
| #{{cite techreport
| |
| | author = [[András Frank]]
| |
| | url = http://www.cs.elte.hu/egres/tr/egres-04-14.pdf
| |
| | title = On Kuhn's Hungarian Method – A tribute from Hungary
| |
| | institution = Egerváry Research Group
| |
| | year = 2004
| |
| }}
| |
| #{{Citation
| |
| | author = [[Michael L. Fredman]] and [[Robert E. Tarjan]]
| |
| | title = Fibonacci heaps and their uses in improved network optimization algorithms
| |
| | journal = [[Journal of the ACM]]
| |
| | volume = 34
| |
| | year = 1987
| |
| | pages = 595–615
| |
| | doi = 10.1145/28869.28874
| |
| | issue = 3
| |
| | postscript = .
| |
| }}
| |
| #{{Citation
| |
| | author = S. J. Cyvin and Ivan Gutman
| |
| | title = Kekule Structures in Benzenoid Hydrocarbons
| |
| | publisher = Springer-Verlag
| |
| | year = 1988
| |
| }}
| |
| #{{Citation
| |
| | author = [[Marek Karpinski]] and Wojciech Rytter
| |
| | title = Fast Parallel Algorithms for Graph Matching Problems
| |
| | publisher = Oxford University Press
| |
| | year = 1998
| |
| | isbn = 978-0-19-850162-6
| |
| }}
| |
| | |
| == External links ==
| |
| * [http://lemon.cs.elte.hu/ A graph library with Hopcroft–Karp and Push–Relabel-based maximum cardinality matching implementation ]
| |
| | |
| [[Category:Matching| ]]
| |
| [[Category:Combinatorial optimization]]
| |
| [[Category:Polynomial-time problems]]
| |