[Paper Review] fastball: A fast algorithm to sample bipartite graphs with fixed degree sequences
This paper introduces fastball, a novel algorithm for uniformly at random sampling bipartite graphs with fixed degree sequences, achieving an optimal O(n) time complexity—faster than the prior state-of-the-art curveball algorithm (O(n log n)). Implemented in C++, fastball reduces sampling time by up to 2.5× in practice, enabling faster backbone extraction in large networks such as the US Senate co-sponsorship network.
Many applications require randomly sampling bipartite graphs with fixed degrees, or randomly sampling incidence matrices with fixed row and column sums. Although several sampling algorithms exist, the ``curveball'' algorithm is the most efficient with an asymptotic time complexity of O(n log n), and has been proven to sample uniformly at random. In this paper, we introduce the ``fastball'' algorithm, which adopts a similar approach but has an asymptotic time complexity of O(n). We show that a C++ implementation of fastball randomly samples large bipartite graphs with fixed degrees faster than curveball, and illustrate the value of this faster algorithm in the context of the fixed degree sequence model for backbone extraction.
Motivation & Objective
- To develop a more computationally efficient algorithm for uniformly random sampling of bipartite graphs with fixed degree sequences.
- To reduce the asymptotic time complexity of existing trade-based sampling algorithms from O(n log n) to O(n).
- To improve practical performance in large-scale network analysis, particularly for backbone extraction in large bipartite projections.
- To provide a faster alternative to the curveball algorithm for applications requiring many random samples from the fixed degree sequence model.
- To enable more scalable and efficient null model testing in network science, ecology, and statistical physics.
Proposed method
- fastball uses a trade-based Markov chain Monte Carlo approach, similar to curveball, but optimizes the trade operation to achieve O(n) time complexity.
- The algorithm selects two nodes uniformly at random, computes their symmetric difference and intersection, then reassigns edges via a shuffled partition of the symmetric difference.
- It maintains adjacency lists and performs efficient updates using sorted data structures to minimize overhead during trade operations.
- The method ensures uniform sampling by preserving detailed balance and ergodicity, proven via the same theoretical framework as curveball.
- A C++ implementation is used to benchmark performance against curveball, leveraging low-level memory access and optimized data handling.
- The algorithm is integrated into the R backbone package via a user-friendly wrapper function, enabling high-level use without C++ expertise.
Experimental results
Research questions
- RQ1Can a trade-based algorithm for sampling bipartite graphs with fixed degrees achieve O(n) time complexity, improving upon the O(n log n) complexity of curveball?
- RQ2Does the proposed fastball algorithm maintain uniform sampling while reducing computational overhead in practice?
- RQ3How much faster is fastball compared to curveball in real-world network analysis workloads, such as backbone extraction in large bipartite projections?
- RQ4Can fastball scale to very large graphs (e.g., m = 10^6 nodes) with significantly reduced runtime compared to curveball?
- RQ5What is the practical impact of faster sampling on the feasibility of large-scale null model testing in network science?
Key findings
- The fastball algorithm achieves an asymptotic time complexity of O(n), outperforming the curveball algorithm’s O(n log n) complexity.
- In C++ implementation, fastball runs approximately 2.5 times faster than curveball when extracting the backbone of the US Senate co-sponsorship network, reducing runtime from 27 to 11 minutes.
- For large-scale graphs with m = 10^6 nodes, fastball performs trades roughly four times faster than curveball in benchmark tests.
- The algorithm produces identical FDSM backbones as curveball, confirming uniform sampling and correctness of the implementation.
- The R function `fastball()` in the backbone package enables seamless integration into existing R-based workflows without requiring C++ expertise.
- Numerical experiments confirm that fastball maintains the same statistical properties as curveball, including uniformity and sufficient mixing after ~5n trades.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.