# Weighted Matchings

• Dieter Jungnickel
Chapter
Part of the Algorithms and Computation in Mathematics book series (AACIM, volume 5)

## Abstract

In Chap. , we studied matchings of maximal cardinality. The present chapter discusses the more general case of weighted matchings, that is, the problem of finding a matching of maximal weight (with respect to a given weight function on the edges). In the bipartite case, this problem is equivalent to the assignment problem considered before, so that the methods discussed in Chap.  apply. Nevertheless, we will give a further algorithm for the bipartite case, the so-called Hungarian algorithm, as this is one of the best known and most important combinatorial algorithms. We then proceed by explaining the connection between matching problems and the theory of linear programming, even though we generally avoid linear programs in this book. We need this to see the deeper reason why the approach used in the Hungarian algorithm works: its success is due to the particularly simple structure of the corresponding polytope, and ultimately to the total unimodularity of the incidence matrix of a bipartite graph. In this context, the reason why the determination of maximal matchings (weighted or not) is considerably more difficult for arbitrary graphs than for bipartite ones will become apparent. As it would make little sense to describe an algorithm for the weighted matching problem in general graphs without using more of the theory of linear programming, no such algorithm is presented in this book. Nevertheless, we will include three interesting applications of weighted matchings: the so-called Chinese postman problem (featuring a postman who wants an optimal route for delivering his mail); the determination of shortest paths for the case where edges of negative weight occur; and the decoding of graphical codes. We shall conclude with a few remarks about matching problems with certain additional restrictions—a situation which occurs quite often in practice; we will see that such problems tend to be inherently more difficult.

## Keywords

Bipartite Graph Perfect Match Complete Bipartite Graph Optimal Match Arbitrary Graph
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

## References

1. [AhuOr92]
Ahuja, R.K., Orlin, J.B.: The scaling network simplex algorithm. Oper. Res. 40(Suppl. 1), S5–S13 (1992)
2. [AhuMO93]
Ahuja, R.K., Magnanti, T.L., Orlin, J.B.: Network Flows: Theory, Algorithms and Applications. Prentice Hall, Englewood Cliffs (1993)
3. [AppCo93]
Applegate, D., Cook, W.: Solving large-scale matching problems. In: Johnson, D.S., McGeoch, C.C. (eds.) Network Flows and Matching, pp. 557–576. Am. Math. Soc., Providence (1993) Google Scholar
4. [Avi78]
Avis, D.: Two greedy heuristics for the weighted matching problem. Congr. Numer. 21, 65–76 (1978)
5. [Avi83]
Avis, D.: A survey of heuristics for the weighted matching problem. Networks 13, 475–493 (1983)
6. [BalRa97]
Balinski, M., Ratier, G.: On stable marriages and graphs, and strategy and polytopes. SIAM Rev. 39, 575–604 (1997)
7. [Bal85]
Ball, M.O.: Polynomial algorithms for matching problems with side constraints. Research report CORR 85–21, University of Waterloo (1985) Google Scholar
8. [BalDe83]
Ball, M.O., Derigs, U.: An analysis of alternate strategies for implementing matching algorithms. Networks 13, 517–549 (1983)
9. [Bar90]
Barahona, F.: On some applications of the Chinese postman problem. In: Korte, B., Lovász, L., Prömel, H.J., Schrijver, A. (eds.) Paths, Flows and VLSI-Layout, pp. 1–16. Springer, Berlin (1990) Google Scholar
10. [BarPu87]
Barahona, F., Pulleyblank, W.R.: Exact arborescences, matchings and cycles. Discrete Appl. Math. 16, 91–99 (1987)
11. [BazSS06]
Bazaraa, M.S., Sherali, H.D., Shetty, C.M.: Nonlinear Programming: Theory and Algorithms, 3rd edn. Wiley, New York (2006)
12. [BazJS10]
Bazaraa, M.S., Jarvis, J.J., Sherali, H.D.: Linear Programming and Network Flows, 4th edn. Wiley, New York (2010)
13. [Bie05]
Bierbrauer, J.: Introduction to Coding Theory. Chapman & Hall/CRC, Boca Raton (2005)
14. [Bla83]
Blahut, R.E.: Theory and Practice of Error Control Codes. Addison-Wesley, Reading (1983)
15. [BreHa67]
Bredeson, J.G., Hakimi, S.L.: Decoding of graph theoretic codes. IEEE Trans. Inf. Theory 13, 348–349 (1967)
16. [BurHZ77]
Burkard, R.E., Hahn, W., Zimmermann, U.: An algebraic approach to assignment problems. Math. Program. 12, 318–327 (1977)
17. [Chv83]
Chvátal, V.: Linear Programming. Freeman, New York (1983)
18. [CunMa78]
Cunningham, W.H., Marsh, A.B.: A primal algorithm for optimal matching. Math. Program. Stud. 8, 50–72 (1978)
19. [DanFF56]
Dantzig, G.B., Ford, L.R., Fulkerson, D.R.: A primal-dual algorithm for linear programs. In: Kuhn, H.W., Tucker, A.W. (eds.) Linear Inequalities and Related Systems, pp. 171–181. Princeton University Press, Princeton (1956) Google Scholar
20. [Der88]
Derigs, U.: Programming in Networks and Graphs. Springer, Berlin (1988)
21. [DerMe91]
Derigs, U., Metz, A.: Solving (large scale) matching problems combinatorially. Math. Program. 50, 113–121 (1991)
22. [Edm65a]
Edmonds, J.: Maximum matching and a polytope with 0,1-vertices. J. Res. Natl. Bur. Stand. B 69, 125–130 (1965)
23. [Edm67a]
Edmonds, J.: An introduction to matching. Lecture Notes, Univ. of Michigan (1967) Google Scholar
24. [EdmGi77]
Edmonds, J., Giles, R.: A min-max relation for submodular functions on graphs. Ann. Discrete Math. 1, 185–204 (1977)
25. [EdmGi84]
Edmonds, J., Giles, R.: Total dual integrality of linear systems. In: Pulleyblank, W.R. (ed.) Progress in Combinatorial Optimization, pp. 117–129. Academic Press Canada, Don Mills (1984) Google Scholar
26. [EdmJo73]
Edmonds, J., Johnson, E.L.: Matching, Euler tours and the Chinese postman. Math. Program. 5, 88–124 (1973)
27. [EdmLP82]
Edmonds, J., Lovász, L., Pulleyblank, W.R.: Brick decompositions and the matching rank of graphs. Combinatorica 2, 247–274 (1982)
28. [EveIS76]
Even, S., Itai, A., Shamir, A.: On the complexity of timetable and multicommodity flow problems. SIAM J. Comput. 5, 691–703 (1976)
29. [FreTa87]
Fredman, M.L., Tarjan, R.E.: Fibonacci heaps and their uses on improved network optimization algorithms. J. Assoc. Comput. Mach. 34, 596–615 (1987)
30. [Gab76]
Gabow, H.N.: An efficient implementation of Edmonds’ algorithm for maximum matchings on graphs. J. Assoc. Comput. Mach. 23, 221–234 (1976)
31. [Gab90]
Gabow, H.N.: Data structures for weighted matching and nearest common ancestors with linking. In: Proc. First Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 434–443. Soc. Ind. Appl. Math., Philadelphia (1990) Google Scholar
32. [GabTa88]
Gabow, H.N., Tarjan, R.E.: Algorithms for two bottleneck optimization problems. J. Algorithms 9, 411–417 (1988)
33. [GabTa89]
Gabow, H.N., Tarjan, R.E.: Faster scaling algorithms for network problems. SIAM J. Comput. 18, 1013–1036 (1989)
34. [GabTa91]
Gabow, H.N., Tarjan, R.E.: Faster scaling algorithms for general graph-matching problems. J. Assoc. Comput. Mach. 38, 815–853 (1991)
35. [GalSh62]
Gale, D., Shepley, L.S.: College admissions and the stability of marriage. Am. Math. Mon. 69, 9–15 (1962)
36. [GarJo79]
Garey, M.R., Johnson, D.S.: Computers and Intractability: A Guide to the Theory of NP-Completeness. Freeman, New York (1979)
37. [GonMi84]
Gondran, M., Minoux, N.: Graphs and Algorithms. Wiley, New York (1984)
38. [Gon92]
Gonzaga, C.C.: Path-following methods for linear programming. SIAM Rev. 34, 167–224 (1992)
39. [GriKa88]
Grigoriadis, M.D., Kalantari, B.: A new class of heuristic algorithms for weighted perfect matching. J. Assoc. Comput. Mach. 35, 769–776 (1988)
40. [Gro85]
Grötschel, M.: Operations Research I. Lecture Notes, Universität Augsburg (1985) Google Scholar
41. [GroHo85]
Grötschel, M., Holland, G.: Solving matching problems with linear programming. Math. Program. 33, 243–259 (1985)
42. [Gus87]
Gusfield, D.: Three fast algorithms for four problems in stable marriage. SIAM J. Comput. 16, 111–128 (1987)
43. [Gus88]
Gusfield, D.: The structure of the stable roommate problem: efficient representation and enumeration of all stable assignments. SIAM J. Comput. 17, 742–769 (1988)
44. [GusIr89]
Gusfield, D., Irving, R.W.: The Stable Marriage Problem. Structure and Algorithms. The MIT Press, Cambridge (1989)
45. [Hof74]
Hoffman, A.J.: A generalization of max flow-min cut. Math. Program. 6, 352–359 (1974)
46. [Hof79]
Hoffman, A.J.: The role of unimodularity in applying linear inequalities to combinatorial theorems. Ann. Discrete Math. 4, 73–84 (1979)
47. [HofKr56]
Hoffman, A.J., Kruskal, J.B.: Integral boundary points of convex polyhedra. In: Kuhn, H.W., Tucker, A.W. (eds.) Linear Inequalities and Related Systems, pp. 233–246. Princeton University Press, Princeton (1956) Google Scholar
48. [HofMa64]
Hoffman, A.J., Markowitz, H.M.: A note on shortest path, assignment and transportation problems. Nav. Res. Logist. Q. 10, 375–379 (1963)
49. [Irn08]
Irnich, S.: Solution of real-world postman problems. Eur. J. Oper. Res. 190, 52–67 (2008)
50. [Irv85]
Irving, R.W.: An efficient algorithm for the ‘stable roommates’ problem. J. Algorithms 6, 577–595 (1985)
51. [IrvLe86]
Irving, R.W., Leather, P.: The complexity of counting stable marriages. SIAM J. Comput. 15, 655–667 (1986)
52. [IrvLG87]
Irving, R.W., Leather, P., Gusfield, D.: An efficient algorithm for the ‘optimal’ stable marriage. J. Assoc. Comput. Mach. 34, 532–543 (1987)
53. [ItaRo78]
Itai, A., Rodeh, M.: Finding a minimum circuit in a graph. SIAM J. Comput. 7, 413–423 (1978)
54. [ItaRT78]
Itai, A., Rodeh, M., Tanimota, S.L.: Some matching problems in bipartite graphs. J. Assoc. Comput. Mach. 25, 517–525 (1978)
55. [JunLe88]
Jungnickel, D., Leclerc, M.: A class of lattices. Ars Comb. 26, 243–248 (1988)
56. [JunLe89]
Jungnickel, D., Leclerc, M.: The 2–matching lattice of a graph. J. Comb. Theory, Ser. B 46, 246–248 (1989)
57. [JunVa96]
Jungnickel, D., Vanstone, S.A.: Graphical codes—a tutorial. Bull. Inst. Comb. Appl. 18, 45–64 (1996)
58. [JunVa97]
Jungnickel, D., Vanstone, S.A.: Graphical codes revisited. IEEE Trans. Inf. Theory 43, 136–146 (1997)
59. [Kar84]
Karmarkar, N.: A new polynomial-time algorithm for linear programming. Combinatorica 4, 373–396 (1984)
60. [Kas67]
Kasteleyn, P.W.: Graph theory and crystal physics. In: Harary, F. (ed.) Graph Theory and Theoretical Physics, pp. 43–110. Academic Press, New York (1967) Google Scholar
61. [Kha79]
Khachiyan, L.G.: A polynomial algorithm in linear programming. Sov. Math. Dokl. 20, 191–194 (1979)
62. [Kuh55]
Kuhn, H.W.: The Hungarian method for the assignment problem. Nav. Res. Logist. Q. 2, 83–97 (1955)
63. [Kuh56]
Kuhn, H.W.: Variants of the Hungarian method for the assignment problem. Nav. Res. Logist. Q. 3, 253–258 (1956)
64. [Kwa62]
Kwan, M.-K.: Graphic programming using odd and even points. Chin. Math. 1, 273–277 (1962)
65. [Law76]
Lawler, E.L.: Combinatorial Optimization: Networks and Matriods. Holt, Rinehart and Winston, New York (1976) Google Scholar
66. [Lec86]
Leclerc, M.: Polynomial time algorithms for exact matching problems. M. Math. thesis, University of Waterloo, Dept. of Combinatorics and Optimization (1986) Google Scholar
67. [Lec87]
Leclerc, M.: Algorithmen für kombinatorische Optimierungsprobleme mit Partitionsbeschränkungen. Dissertation, Universität Köln (1987) Google Scholar
68. [Lov79]
Lovász, L.: Graph theory and integer programming. Ann. Discrete Math. 4, 141–158 (1979)
69. [Lov85]
Lovász, L.: Some algorithmic problems on lattices. In: Lovász, L., Smerédi, E. (eds.) Theory of Algorithms, pp. 323–337. North Holland, Amsterdam (1985) Google Scholar
70. [Lov87]
Lovász, L.: The matching structure and the matching lattice. J. Comb. Theory, Ser. B 43, 187–222 (1987)
71. [MacSl77]
MacWilliams, F.J., Sloane, N.J.A.: The Theory of Error-Correcting Codes. North Holland, Amsterdam (1977)
72. [NemWo88]
Nemhauser, G.L., Wolsey, L.A.: Integer and Combinatorial Optimization. Wiley, New York (1988)
73. [NobPi96]
Nobert, Y., Picard, J.-C.: An optimal algorithm for the mixed Chinese Postman Problem. Networks 27, 95–108 (1996)
74. [NtaHa81]
Ntafos, S.C., Hakimi, S.L.: On the complexity of some coding problems. IEEE Trans. Inf. Theory 27, 794–796 (1981)
75. [OrlAh92]
Orlin, J.B., Ahuja, R.K.: New scaling algorithms for the assignment and minimum cycle mean problems. Math. Program. 54, 41–56 (1992)
76. [Pap76]
Papadimitriou, C.H.: On the complexity of edge traversing. J. Assoc. Comput. Mach. 23, 544–554 (1976)
77. [PapSt82]
Papadimitriou, C.H., Steiglitz, K.: Combinatorial Optimization: Algorithms and Complexity. Prentice Hall, Englewood Cliffs (1982)
78. [PapYa82]
Papadimitriou, C.H., Yannakakis, M.: The complexity of restricted spanning tree problems. J. Assoc. Comput. Mach. 29, 285–309 (1982)
79. [Rie91]
Rieder, J.: The lattices of matroid bases and exact matroid bases. Arch. Math. 56, 616–623 (1991)
80. [Rob03a]
Robinson, S.: Are medical students meeting their (best possible) match? SIAM News 36(3), 8–9 (2003) Google Scholar
81. [Rob03b]
Robinson, S.: How much can matching theory improve the lot of medical residents? SIAM News 36(6), 4–5 (2003) Google Scholar
82. [Schr83a]
Schrijver, A.: Min-max results in combinatorial optimization. In: Bachem, A., Grötschel, M., Korte, B. (eds.) Mathematical Programming: The State of the Art, pp. 439–500. Springer, Berlin (1983)
83. [Schr83b]
Schrijver, A.: Short proofs on the matching polyhedron. J. Comb. Theory, Ser. B 34, 104–108 (1983)
84. [Schr84]
Schrijver, A.: Total dual integrality from directed graphs, crossing families, and sub- and supermodular functions. In: Pulleyblank, W.R. (ed.) Progress in Combinatorial Optimization, pp. 315–361. Academic Press, San Diego (1984) Google Scholar
85. [Schr86]
Schrijver, A.: Theory of Integer and Linear Programming. Wiley, New York (1986)
86. [Schr03]
Schrijver, A.: Combinatorial Optimization. Polyhedra and Efficiency. Springer, Berlin (2003) (in 3 volumes)
87. [Tar83]
Tarjan, R.E.: In: Data Structures and Network Algorithms. Soc. Ind. Appl. Math., Philadelphia (1983)
88. [Ter96]
Terlaky, T.: Interior Point Methods of Mathematical Programming. Kluwer, Dordrecht (1996)
89. [Tut54]
Tutte, W.T.: A short proof of the factor theorem for finite graphs. Can. J. Math. 6, 347–352 (1952)
90. [Vai89]
Vaidya, P.M.: Geometry helps in matching. SIAM J. Comput. 19, 1201–1225 (1989)
91. [vanLi99]
van Lint, J.H.: Introduction to Coding Theory, 3rd edn. Springer, Berlin (1999)
92. [Wil72]
Wilson, L.B.: An analysis of the stable marriage assignment problem. BIT Numer. Math. 12, 569–575 (1972)
93. [Zim81]
Zimmermann, U.: Linear and Combinatorial Optimization in Ordered Algebraic Structures. North Holland, Amsterdam (1981)