Sequential importance sampling for estimating expectations over the space of perfect matchings

Yeganeh Alimohammadi, Persi Diaconis, Mohammad Roghani, Amin SaberiarXiv 2021

Abstract

This paper makes three primary contributions to the estimation of perfect matchings in bipartite graphs. First, we provide a theoretical proof that the popular sequential importance sampling (SIS) algorithm operates in polynomial time for dense bipartite graphs. Specifically, our algorithm yields a $(1\pm\epsilon)$-approximation for the number of perfect matchings in a $\lambda$-dense bipartite graph using $O(n^{\frac{1-2\lambda}{\lambda}\epsilon^{-2}})$ samples. Second, we introduce a novel preprocessing step that significantly improves the practical efficiency of the algorithm, which typically requires numerous calls to matching subroutines. Third, we demonstrate the algorithm's utility through three diverse applications: counting Latin squares, optimizing greedy strategies in card-guessing games with feedback, and analyzing stochastic block models. These examples show that SIS can effectively handle practical problems of reasonably large sizes.

Introduction

Counting the number of perfect matchings in a bipartite graph is a fundamental problem in combinatorics and computer science. It is equivalent to computing the permanent of a 0-1 matrix, a task famously proven by Valiant to be #P-complete. While theoretical computer scientists have developed Fully Polynomial Randomized Approximation Schemes (FPRAS) for this task, these methods are often too slow for practical use.

In practice, researchers frequently turn to Sequential Importance Sampling (SIS). SIS builds a matching one edge at a time, using weights to guide the sampling process. While empirically successful, SIS lacked rigorous theoretical guarantees regarding its convergence rate—until now. This research, a collaboration involving Stanford University, bridges the gap between the heuristic success of SIS and its mathematical foundation.

The Scaled SIS Algorithm

The core of the proposed approach is a specific variant of SIS guided by doubly-stochastic matrix scaling, often referred to as Sinkhorn scaling.

Matrix Scaling

Given an adjacency matrix $A$, the algorithm first finds diagonal matrices $D_\alpha$ and $D_\beta$ such that $Q^A = D_\alpha A D_\beta$ is doubly stochastic (where all rows and columns sum to 1). This matrix $Q^A$ provides the probabilities used to select edges during the sampling process. Without this scaling, SIS can fail spectacularly, requiring an exponential number of samples even for relatively simple graph structures.

The Sampling Process

The algorithm proceeds by picking a random order of vertices. For each vertex, it selects an available neighbor with a probability proportional to the entries in the scaled matrix $Q^A$. To ensure the algorithm remains efficient in practice, the authors implemented a preprocessing step using the Dulmage-Mendelsohn decomposition, which prunes the graph and avoids exploring edges that cannot be part of a perfect matching.

Theoretical Guarantees

The paper's primary theoretical contribution is the first polynomial-time guarantee for scaled SIS on dense bipartite graphs. By bounding the Kullback–Leibler (KL) divergence between the sampling distribution and the true uniform distribution, the authors prove that for $\lambda$-dense graphs (where all degrees are greater than $(\lambda + \frac{1}{2})n$), the algorithm provides a $(1 \pm \epsilon)$-approximation in $O(n^3)$ time per sample.

Applications and Results

The authors demonstrate the power of their implementation across three distinct domains:

1. Counting Latin Squares and Rectangles

Latin squares are $n \times n$ matrices where every row and column contains distinct integers. Estimating the number of Latin squares for large $n$ is a classic combinatorial challenge. The authors used their SIS estimator to evaluate competing conjectures. Their results for $n$ up to 20 strongly support Timashov’s conjecture over the EMM conjecture regarding the asymptotic growth of Latin squares.

2. Card Guessing with Feedback

In a card-guessing game where a player receives feedback after each guess, the optimal "greedy" strategy involves picking the most likely card remaining. The authors show that calculating this strategy is mathematically equivalent to evaluating the permanents of specific zero-blocked matrices. SIS allows for the practical computation of these strategies in real-time for large decks.

3. Stochastic Block Models (SBM)

To test the algorithm's robustness, the authors applied it to bipartite graphs generated via Stochastic Block Models. They found that doubly-stochastic scaling reduced the standard deviation of the estimates by a factor of 4x to 10x compared to unscaled SIS, highlighting the critical role of scaling in variance reduction.

Conclusion and Future Work

This work provides a rigorous mathematical justification for a widely used heuristic, proving that scaled SIS is an efficient approximation scheme for dense bipartite graphs. While the current theoretical bounds focus on the dense case, empirical evidence suggests the algorithm performs well on many sparse structures. Future research may focus on extending these polynomial-time guarantees to sparse graphs and general (non-bipartite) matching problems.

Summary updated

BibTeX
@misc{alimohammadi2021sequential,
  author = {Yeganeh Alimohammadi and Persi Diaconis and Mohammad Roghani and Amin Saberi},
  title = {{Sequential importance sampling for estimating expectations over the space of perfect matchings}},
  year = {2021},
  eprint = {2107.00850},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2107.00850},
}
Figure