Efficient Algorithms and Implementations for Extracting Maximum-Size $(k,\ell)$-Sparse Subgraphs
Péter Madarasi
TL;DR
This work addresses the problem of extracting maximum-size $(k,\ell)$-sparse subgraphs in multigraphs, a foundational task in rigidity theory and combinatorial optimization. It builds on the classic augmenting-path framework, maintaining an inner digraph $D$ and reorienting edges via path reversals to preserve sparsity, with a matroid structure ensuring optimality for $0\le \ell < 2k$ and a maximal (but not guaranteed maximum) solution for $\ell = 2k$. The main contributions are a highly optimized C++ implementation of multiple augmenting-path variants augmented with edge- and node-ordering heuristics, a two-phase forest-based preprocessing, and, for the special case $(k,2k)$, an $O(nm)$ algorithm; the code is publicly available and proposed for the LEMON library. Experiments on synthetic and real-world graphs demonstrate substantial speedups over existing tools, highlighting the practical impact of preprocessing and ordering strategies for rigidity-related computations.
Abstract
A multigraph $G = (V, E)$ is $(k, \ell)$-sparse if every subset $X \subseteq V$ induces at most $\max\{k|X| - \ell, 0\}$ edges. Finding a maximum-size $(k, \ell)$-sparse subgraph is a classical problem in rigidity theory and combinatorial optimization, with known polynomial-time algorithms. This paper presents a highly efficient and flexible implementation of an augmenting path method, enhanced with a range of powerful practical heuristics that significantly reduce running time while preserving optimality. These heuristics $\unicode{x2013}$ including edge-ordering, node-ordering, two-phase strategies, and pseudoforest-based initialization $\unicode{x2013}$ steer the algorithm toward accepting more edges early in the execution and avoiding costly augmentations. A comprehensive experimental evaluation on both synthetic and real-world graphs demonstrates that our implementation outperforms existing tools by several orders of magnitude. We also propose an asymptotically faster algorithm for extracting an inclusion-wise maximal $(k,2k)$-sparse subgraph with the sparsity condition required only for node sets of size at least three, which is particularly relevant to 3D rigidity when $k = 3$. We provide a carefully engineered implementation, which is publicly available online and is proposed for inclusion in the LEMON graph library.
