Table of Contents
Fetching ...

Gabow's Cardinality Matching Algorithm in General Graphs: Implementation and Experiments

Matin Ansaripour, Alireza Danaei, Kurt Mehlhorn

TL;DR

The paper presents a C++ LEDA-based implementation of Gabow's general matching algorithm for maximum cardinality matching in general graphs. It details a two-phase SAP-based framework with blossom contraction, translating SAPs in the original graph to augmenting paths in an auxiliary contracted graph H, and then augments via Phase 2, leveraging LEDA’s GT91 routine for the final steps. The study shows substantial worst-case improvements (O(sqrt{n} m)) over O(n m) methods and near-linear performance on random graphs, while highlighting memory hierarchy effects and practical considerations. The authors provide open-source code and a thorough experimental evaluation across worst-case constructions and random graphs, offering a solid platform for comparing general-graph matching algorithms in practice.

Abstract

It is known since 1975 (\cite{HK75}) that maximum cardinality matchings in bipartite graphs with $n$ nodes and $m$ edges can be computed in time $O(\sqrt{n} m)$. Asymptotically faster algorithms were found in the last decade and maximum cardinality bipartite matchings can now be computed in near-linear time~\cite{NearlyLinearTimeBipartiteMatching, AlmostLinearTimeMaxFlow,AlmostLinearTimeMinCostFlow}. For general graphs, the problem seems harder. Algorithms with running time $O(\sqrt{n} m)$ were given in~\cite{MV80,Vazirani94,Vazirani12,Vazirani20,Vazirani23,Goldberg-Karzanov,GT91,Gabow:GeneralMatching}. Mattingly and Ritchey~\cite{Mattingly-Ritchey} and Huang and Stein~\cite{Huang-Stein} discuss implementations of the Micali-Vazirani Algorithm. We describe an implementation of Gabow's algorithm~\cite{Gabow:GeneralMatching} in C++ based on LEDA~\cite{LEDAsystem,LEDAbook} and report on running time experiments. On worst-case graphs, the asymptotic improvement pays off dramatically. On random graphs, there is no improvement with respect to algorithms that have a worst-case running time of $O(n m)$. The performance seems to be near-linear. The implementation is available open-source.

Gabow's Cardinality Matching Algorithm in General Graphs: Implementation and Experiments

TL;DR

The paper presents a C++ LEDA-based implementation of Gabow's general matching algorithm for maximum cardinality matching in general graphs. It details a two-phase SAP-based framework with blossom contraction, translating SAPs in the original graph to augmenting paths in an auxiliary contracted graph H, and then augments via Phase 2, leveraging LEDA’s GT91 routine for the final steps. The study shows substantial worst-case improvements (O(sqrt{n} m)) over O(n m) methods and near-linear performance on random graphs, while highlighting memory hierarchy effects and practical considerations. The authors provide open-source code and a thorough experimental evaluation across worst-case constructions and random graphs, offering a solid platform for comparing general-graph matching algorithms in practice.

Abstract

It is known since 1975 (\cite{HK75}) that maximum cardinality matchings in bipartite graphs with nodes and edges can be computed in time . Asymptotically faster algorithms were found in the last decade and maximum cardinality bipartite matchings can now be computed in near-linear time~\cite{NearlyLinearTimeBipartiteMatching, AlmostLinearTimeMaxFlow,AlmostLinearTimeMinCostFlow}. For general graphs, the problem seems harder. Algorithms with running time were given in~\cite{MV80,Vazirani94,Vazirani12,Vazirani20,Vazirani23,Goldberg-Karzanov,GT91,Gabow:GeneralMatching}. Mattingly and Ritchey~\cite{Mattingly-Ritchey} and Huang and Stein~\cite{Huang-Stein} discuss implementations of the Micali-Vazirani Algorithm. We describe an implementation of Gabow's algorithm~\cite{Gabow:GeneralMatching} in C++ based on LEDA~\cite{LEDAsystem,LEDAbook} and report on running time experiments. On worst-case graphs, the asymptotic improvement pays off dramatically. On random graphs, there is no improvement with respect to algorithms that have a worst-case running time of . The performance seems to be near-linear. The implementation is available open-source.
Paper Structure (37 sections, 6 theorems, 10 equations, 3 figures, 6 tables)

This paper contains 37 sections, 6 theorems, 10 equations, 3 figures, 6 tables.

Key Result

Lemma 1

$z$-values are always even and the $d$-values of all vertices in the search structure have the same parity. When a tight edge $xy$ is explored from $x$, we have $d(y) = -d(x)$. In a grow step, we have $d(x) = -1$. All free vertices have the same dual value $1 - \Delta$. The reduced weight of an edge

Figures (3)

  • Figure 1: Reprinted from Gabow:GeneralMatching. Note that between (b) and (c), there are two updates of the vertex duals. The z-values of blossoms are shown inside the blossom. The augmenting path has length 13. It consists of 7 non-matching edges and 6 matching edges. The total weight of the matching edges in the path is 12.
  • Figure 2: The original and the contracted graph for the graph in Figure \ref{['while-loop in first phase']}. The original graph is shown on the left with matching edges in red. The contracted graph is shown on the right. Nodes 0 to 10 of $G$ are contracted into node 0 of H and nodes 15, 16, and 17 are contracted into node 5. The edges $(5,12)$ and $(5,15)$ are not tight and hence are not added to $H$.
  • Figure 3: In the top chain there are three augmenting paths, namely with endpoints $u$ and $v$, $v$ and $w$, and $w$ and $x$, respectively. Using the path from $v$ to $w$ for augmentation, merges the three paths into one. If one endpoint of the augmenting path used is an endpoint of the containing chain, only two paths are merged.

Theorems & Definitions (6)

  • Lemma 1
  • Lemma 2
  • Lemma 3
  • Lemma 4: Lemma 3.1 and Corollary 3.2 in Gabow:GeneralMatching
  • Lemma 5
  • Lemma 6