1.4.6 Matching

Problem Input | Problem Output

INPUT                    OUTPUT


Input Description: A (weighted) graph G=(V,E).

Problem: Find the largest size set of edges S \in E such that each vertex in V is incident to at most one edge of S.

Excerpt from The Algorithm Design Manual: Consider a set of employees, each of whom is capable of doing some subset of the tasks that must be performed. We seek to find an assignment of employees to tasks such that each task is assigned to a unique employee. Each mapping between an employee and a task they can handle defines an edge, so what we need is a set of edges with no employee or job in common, i.e. a matching.

Efficient algorithms for constructing matchings are based on constructing augmenting paths in graphs. Given a (partial) matching M in a graph G, an augmenting path P is a path of edges where every odd-numbered edge (including the first and last edge) is not in M, while every even-numbered edge is. Further, the first and last vertices must not be already in M. By deleting the even-numbered edges of P from M and replacing them with the odd-numbered edges of P, we enlarge the size of the matching by one edge. Berge's theorem states that a matching is maximum if and only if it does not contain any augmenting path. Therefore, we can construct maximum-cardinality matchings by searching for augmenting paths and stopping when none exist.

The best book available for this problem is Network Flows : Theory, Algorithms, and Applications by Ravindra K. Ahuja, Thomas L. Magnanti, and James B. Orlin.


Implementations

  • Goldberg's Network Optimization Codes (C) (rating 9)
  • RAPID - Robust and Accurate Polygon Interface detection (FORTRAN) (rating 9)
  • BIPM -- Bipartite Matching Codes (C) (rating 8)
  • LEDA - A Library of Efficient Data Types and Algorithms (C++) (rating 7)
  • Moret and Shapiro's Algorithms P to NP (Pascal) (rating 4)
  • The Stanford GraphBase (C) (rating 4)
  • Netlib / TOMS -- Collected Algorithms of the ACM (FORTRAN) (rating 3)
  • Discrete Optimization Methods (Pascal) (rating 3)
  • Combinatorica (Mathematica) (rating 3)
  • Algorithms in C++ -- Sedgewick (C++) (rating 2)

    Related Problems

  • Determinants and Permanents
  • Eulerian Cycle / Chinese Postman
  • Network Flow
  • Job Scheduling
  • Set Cover


    Previous Problem Next Problem

    View the graph for this file

    Bulletin Board
    About ``The Algorithm Design Manual''.
    Send us Mail
    The Stony Brook Algorithm Repository -- go to front page

    This page last modified on Wed Mar 07, 2001 .