An impossibility result for Markov Chain Monte Carlo
sampling
from micro-canonical bipartite graph ensembles
Abstract
Markov Chain Monte Carlo (MCMC) algorithms are commonly used to sample from graph ensembles. Two graphs are neighbors in the state space if one can be obtained from the other with only a few modifications, e.g., edge rewirings. For many common ensembles, e.g., those preserving the degree sequences of bipartite graphs, rewiring operations involving two edges are sufficient to create a fully-connected state space, and they can be performed efficiently. We show that, for ensembles of bipartite graphs with fixed degree sequences and number of butterflies ( bi-cliques), there is no universal constant such that a rewiring of at most edges at every step is sufficient for any such ensemble to be fully connected. Our proof relies on an explicit construction of a family of pairs of graphs with the same degree sequences and number of butterflies, with each pair indexed by a natural , and such that any sequence of rewiring operations transforming one graph into the other must include at least one rewiring operation involving at least edges. Whether rewiring these many edges is sufficient to guarantee the full connectivity of the state space of any such ensemble remains an open question. Our result implies the impossibility of developing efficient, graph-agnostic, MCMC algorithms for these ensembles, as the necessity to rewire an impractically large number of edges may hinder taking a step on the state space.
I Introduction
Testing the statistical significance of properties of an observed network is a fundamental problem in network science [1]. The significance of the observed value is tested against a null model, an ensemble composed of the set of possible graphs that can be realized under the null hypothesis and a probability distribution over . One typically selects some descriptive characteristics of the observed network, and either defines and in such a way that the expectations w.r.t. of these characteristics over are the same as the observed ones (a.k.a. the canonical model), or defines as the set of all and only the graphs with exactly the same values for the characteristics as the observed network, and can be any distribution, often the uniform. Once the null model is defined, one proceeds by sampling several graphs from this ensemble. These graphs are used to approximate the distribution of the test statistic of interest under the null hypothesis. By comparing the observed statistic to this distribution one can compute an empirical -value.
For example, the widely used “configuration model” [2] considers the set of graphs with the same degree sequence as the observed network and the uniform distribution. This model has been instrumental in determining that clustering, assortativity, and community structure in real networks are not solely dependent on node degrees, hence highlighting their significance [3]. However, the configuration model fails to generate graphs with a local structure similar to the observed graph [4]. Researchers have thus explored alternative null models that sample from graph families defined by more complex characteristics of the observed graph, such as joint degree distribution [5, 4, 6, 7], core-value sequence [8], and local triangle-count sequence [9].
In this work, we focus on bipartite graphs, i.e., networks whose nodes can be partitioned into two classes such that all edges go from one class to the other. Formally, a bipartite graph is a tuple , where and are disjoint sets of nodes called left and right nodes, respectively, and is a set of edges connecting nodes in to nodes in . We consider undirected bipartite graphs, but for ease of presentation, we denote any edge so that and . For any vertex we denote with the set of neighbors of , i.e., the vertices to which is connected by an edge in , and we define the degree of in as . Assuming an arbitrary but fixed labeling (resp. ) of the nodes in (resp. ), the vector (resp. ) is known as the left (resp. right) degree sequence of .
Bipartite networks occur naturally in many applications: when representing words and documents [10], items and itemsets [11], higher-order networks such as hypergraphs and simplicial complexes [12], and many more. Null models and graph ensembles can also be defined on bipartite graphs [13, 11, 14]. For example, Preti et al. [11] introduce a null model that preserves the bipartite joint adjacency matrix (i.e., the matrix whose -th entry is the number of edges connecting nodes from with degree to nodes in with degree ), of an observed network (thus the degree sequences and the number of caterpillars, i.e., paths of length 3), and give Markov Chain Monte Carlo (MCMC) algorithms to sample from this null model. Null models for bipartite graphs are also of particular interest because they align with null models for 0–1 binary matrices [15, Ch. 6]. For example, preserving the degree sequences in a bipartite graph corresponds to preserving the row and column marginals of the corresponding bi-adjacency matrix, and several MCMC algorithms have been developed to sample from this null model [16, 17, 18, 19, 20].
We consider graph ensembles for which is the set of all bipartite graphs that share the same degree sequences and the same number of butterflies, i.e., bi-cliques , defined as follows.
Definition 1 (Butterfly).
Let be a bipartite graph. Two distinct nodes and two distinct nodes belong to the butterfly in if and only if .
The following result, whose proof is immediate, gives an expression for the number of butterflies to which two nodes both belong.
Fact 1.
Let be a bipartite graph, and let and be distinct nodes in . The number of butterflies in to which both and belong is
where we assume . A similar result holds for any two distinct nodes in .
For , we denote with the number of butterflies in to which belongs. It holds
(1) |
The total number of butterflies in is then
(2) |
The butterfly, being the smallest complete subgraph in a bipartite graph, is the most basic building block for composing more complex structures, analogous to the triangle in unipartite graphs. Consequently, preserving the number of butterflies emerges as a natural choice when defining null models that retain more graph properties beyond just the degree sequences. This concept finds applications in studying, e.g., clustering patterns [21].
MCMC methods are a popular approach to sample from an ensemble . They define a suitable Markov chain on the space of all possible graphs, such that, after a sufficient burn-in period, the state of the Markov chain is approximately distributed according to . The correctness of this process requires the Markov chain to be finite, irreducible, and aperiodic [2]. Efficient sampling requires not only that the Markov chain has a fast mixing time, but also that the space can be explored quickly, i.e., that obtaining a neighbor from the current state is efficient. The double edge swap technique, also known as degree-preserving rewiring [22], checkerboard swap [23], or tetrad [17], is a simple yet fundamental randomization technique used to generate a new graph with the same degree sequence as a given graph. Its efficiency stems from the fact that it involves the rewiring of a small number of edges. In bipartite graphs, the most basic rewiring technique is known as the bipartite swap operation (BSO).
Definition 2 (BSO).
Let be a bipartite graph and , such that and . The BSO involving and removes and from , and adds and to . The resulting bipartite graph has the same left and right degree sequence of .
A more sophisticated operation is the -edge bipartite swap operation (-BSO), which may involve the simultaneous swapping of multiple edges, potentially between a large set of nodes, similar to the -switch operation defined by Tabourier et al. [24].
Definition 3 (-BSO).
Let be a bipartite graph and . A -BSO is a pair with being a vector of distinct edges , and being a derangement of , i.e., a permutation of with no element in its original position, s.t. for each . Replacing each with generates a bipartite graph with the same left and right degree sequence as .
According to this definition, a BSO involving and can be seen as the -BSO . Algorithms such as Verhelst’s [17] and Curveball [20] aim to speed up the sampling from the ensemble of bipartite graphs with fixed degree sequences. They execute multiple BSO operations at each step by selecting nodes and from (or ) and exchanging multiple edges originating from with edges originating from . Conversely, a -BSO may involve the simultaneous swapping of multiple edges originating from multiple source nodes. Thus, the moves considered by Curveball and Verhelst’s can be expressed as -BSOs, but -BSOs are more expressive, in the sense that there are -BSOs that do not correspond to possible moves for these algorithms.
II Connectivity of the state space
A key requirement to use an MCMC method for sampling from a graph ensemble is that the state space, where each state corresponds to a graph in the ensemble, is strongly connected , i.e., for any two states and there is a sequence of graph-transforming operations for some (which may depend on the chosen and , such that transforms into some that belongs to the state space, for transforms into that also belongs to the state space, and transforms into . In other words, a class of graph-transforming operations defines a neighborhood structure of the state space as follows: given any in the state space, a neighbor of is any state that can be obtained by applying a single operation from , provided that the operation is applicable to . With this neighborhood structure, the state space is strongly connected if there is a path from any state to any other state.
We can immediately see that the state space we consider is strongly connected by sequences of -BSOs when is large enough, for any left and right degree sequences, and any number of butterflies (see also [24, Sect. 3.2.2]). In fact, there is always a -BSO that transforms any bipartite graph into another bipartite graph with the same left and right degree sequences, and number of butterflies (see Supplementary Material [25] for details). While this fact ensures the strong connectivity of the state space via the union of all -BSOs for , it has little practical relevance, as we now explain. If we use all these -BSOs to define the neighborhood structure of the state space, the resulting space would be a complete graph, i.e., a clique. Consequently, drawing, according to any distribution, a neighbor of a given state would require a procedure to build an entirely new bipartite graph with the same degree sequences and the same number of butterflies from scratch. Developing such a procedure seems even harder than the problem we are attempting to solve, in the same way as devising algorithms for building a bipartite graph with prescribed degree sequences from scratch [26, 27, 28, 29, 30] is much harder than devising algorithms for sampling such a graph using MCMC approaches starting from an existing one [17, 20, 16, 18, 19].
The correct question to ask is therefore the following: is there a fixed, universal, constant such that, for any left and right degree sequences, and any number of butterflies, any two bipartite graphs with those left and right degree sequences, and that number of butterflies, are connected by sequences of -BSOs, with , , where may depend on the two graphs? By “universal”, we mean a quantity that in no way depends on properties of the ensemble , including properties of the observed network.
Asking this question is reasonable: it is known that when one is only interested in preserving the degree sequences [15, Ch. 6], and it is also known that for the case of preserving the degree sequences and the number of paths of length 3 (a.k.a. caterpillars), in which case the rewiring operations slightly differ from the traditional BSOs [11, 31].
Additionally, we would like to be small, because sampling a -BSO is not necessarily efficient: the naïve approach of independently sampling edges and then verifying whether they form a valid -BSO has an increasing probability of failure as increases [24]. As a result, the Markov chain would exhibit a high probability of staying in the same state for many consecutive steps, greatly increasing the mixing time.
For unipartite graphs, it has been proved that is not always sufficient to ensure strong connectivity of spaces of graphs that share more complex properties [24, 31]. In this work, we demonstrate the nonexistence of a fixed, universal, constant for the ensemble of bipartite graphs with the same left and right degree sequences and the same number of butterflies.
Let us give some intuition with an example, which shows that it cannot be . Figure 1 shows two bipartite graphs (upper) and (lower) with the same left and right degree sequences, and the same number of butterflies . There is no sequence of -BSO s for that, when applied to , generates a graph isomorphic to : any -BSO for applied to either generates a graph with a different number of butterflies, or generates a graph isomorphic to . On the other hand, the -BSO with , , , and ensures that the two butterflies and disappear, while the two new butterflies and appear, hence preserving the total count .

Our main result is the following theorem (proof in Supplementary Material [25]).
Theorem 1.
For any with , there exist two non-isomorphic bipartite graphs and with the same left and right degree sequences, and , such that for any sequence of -BSOs with , , that transforms into , there exists with .
Our proof consists of two parts. First, we construct two bipartite graphs and with the same left and right degree sequences (which will depend on as the second largest left degree will be greater than ), and the same number of butterflies. Second, we demonstrate that any sequence of -BSOs applied to to obtain a graph isomorphic to must involve at least one -BSO for . Since can be arbitrarily large, a universal constant as above cannot exist.
This theorem proves that it is impossible to design efficient MCMC algorithms that sample from ensembles of bipartite graphs with the same degree sequences and the same number of butterflies, because the state space is not strongly connected by edge swap operations that involve only up to a fixed, universal, number of edges, as is instead the case for simpler null models. Rather, the minimum number of edges that must be involved depends on properties of the state space , not just of the observed network. These may not be easily computable, as they may not depend just on the observed network, if any.
This result has profound implications for the design of network null models and for network science in general. If it is unfeasible to preserve the occurrences of the simplest building block of bipartite graphs (the butterfly), it becomes unfeasible to preserve larger structures. When dealing with bipartite graphs and complex observed characteristics, ensembles with “soft” constraints, where the constraints are retained on average over all the graphs sampled from the ensemble [32], might be the only viable option.

The algorithm to construct the graphs and is delineated in the Supplementary Material [25]. We now describe the main characteristics of such graphs.
Let and be two naturals with and . We define and . The graphs and output by the algorithm with inputs and have the following properties:
-
1.
and have left nodes (denoted with the letter ) and right nodes (denoted with the letter );
-
2.
and have the same left and right degree sequences. In particular, and have degree , and have degree , and have degree , has degree 2 for , and all the other left and right nodes have degree ;
-
3.
;
-
4.
, which, with the previous point, implies that and belong to all butterflies in , and every other node belongs to no butterfly;
-
5.
, , , which implies, with point 2, that and do not belong to all butterflies in .
Figure 2 shows the bipartite graphs generated for and .
III Discussion
MCMC approaches based on swaps of pairs of edges can efficiently sample graphs from simple ensembles, such as those including graphs with prescribed degree sequences, or fixed number of paths of length up to three [11]. The correctness of these approaches relies on the fact that pairwise edge swaps create a strongly connected state space. They are efficient because proposing a neighbor to move to is relatively easy, requiring only to be able to efficiently sample pairs of edges.
In the case of ensembles preserving more complex properties of the networks, the strong connectivity of the state space may require more than two edges to be swapped at every step, i.e., performing -switches [24], or -BSOs, for some value of .
In this work, we consider the ensemble of bipartite graphs with fixed degree sequences and fixed number of butterflies ( bi-cliques), for its important role in a variety of applications, e.g., investigating clustering patterns [21]. We show that the state space is not strongly connected by sequences of -BSOs for any fixed, universal, constant . In other words, the number of edges to be rewired at each step is upper bounded by a quantity that depends on properties of the graphs in the ensemble. This result is in strong contrast with the cases for the space of bipartite graphs with fixed degree sequences, and for that of bipartite graphs with fixed degree sequences and fixed number of paths of length three (a.k.a. caterpillars), where is sufficient for all ensembles [11, 31].
This discovery has far-reaching implications for network science. First and foremost, we rule out the possibility of designing efficient MCMC algorithms for sampling from the space of bipartite graphs with fixed degree sequences and fixed number of butterflies, specifically, from the micro-canonical ensemble that maintains these properties exactly. In fact, we demonstrate the necessity of swaps with size dependent on the characteristics of the graph space , not necessarily just on the observed network. Finding what this size is may not even be feasible. It may perhaps be possible to develop an efficient procedure to find this quantity, but then one also needs an efficient procedure to, at each step of the Markov chain, generate a -BSO for , to propose a neighbor to move to. Solving both these algorithmic questions seem challenging. Moreover, the lower bound to the size of the BSOs needed to connect the two graphs and from Thm. 1 gives only a necessary condition for the strong connectivity of the graph space, not a sufficient one: we only know that one of the BSOs to connect these two graphs must contain more than edges, but not how exactly how many. Even if we knew exactly this number , there may be other pairs of graphs in the same ensemble (i.e., with the same degree sequences and number of butterflies) such that any sequence of BSOs connecting these two graphs must have size even greater than . Therefore the situation might be even more dire than our findings suggest.
Given that sampling from a null model that preserves the number of butterflies is impractical, preserving larger structures seems an even more unattainable task. A butterfly is at the same time the smallest cycle and the smallest non-trivial bi-clique, hence it is a basic building block of bipartite graphs. Thus, our findings present a large obstacle to developing efficient algorithms to sample from more complex ensembles, and therefore to testing network properties under more descriptive null models.
What other options are then available, if any? If one wishes to maintain the number of butterflies as a hard constraint (i.e., to sample from the micro-canonical ensemble), one potential approach involves avoiding MCMC algorithms and opting for a direct-sampling algorithm like stub matching [33]. However, such algorithms are already limited to small graph instances, for the case of sampling from the space of graphs with the same degree sequence, due to their complexity scaling quadratically or cubically with the number of nodes, depending on the graph density [34, 35]. The straightforward application of existing stub-matching techniques may also suffer from generating graphs with a different number of butterflies, thus leading to a high rejection rate. Thus, we need to explore alternative methodologies or refine existing stub-matching algorithms to better accommodate these more complex constraints. Finally, implementations of canonical methods such as the Chung-Lu model [36] offer a more efficient alternative, albeit at the cost of imposing a soft constraint. Indeed, while the ensemble average aligns precisely with the desired value of each constraint, individual graph instances may lie far from the desired constraints. The canonical ensemble brings other challenges, including difficulties in generating graphs that closely match the desired expectations for certain degree distributions (degeneracy problem) [37, 38, 39, 40, 41].
Overall, our findings represent a strong negative result that the network science community needs to reckon with. By showing that this research avenue is not fruitful, we hope to spur alternative and innovative approaches to designing null models for graphs, and algorithms for sampling from them.
Acknowledgments. MR’s work was sponsored in part by NSF grants IIS-2006765 and CAREER-2238693.
References
- Newman [2003] M. E. Newman, SIAM review 45, 167 (2003).
- Fosdick et al. [2018] B. K. Fosdick, D. B. Larremore, J. Nishimura, and J. Ugander, Siam Review 60, 315 (2018).
- Cimini et al. [2019] G. Cimini, T. Squartini, F. Saracco, D. Garlaschelli, A. Gabrielli, and G. Caldarelli, Nature Reviews Physics 1, 58 (2019).
- Stanton and Pinar [2012] I. Stanton and A. Pinar, Journal of Experimental Algorithmics (JEA) 17, 3 (2012).
- Mahadevan et al. [2006] P. Mahadevan, D. Krioukov, K. Fall, and A. Vahdat, ACM SIGCOMM Computer Communication Review 36, 135 (2006).
- Orsini et al. [2015] C. Orsini, M. M. Dankulov, P. Colomer-de Simón, A. Jamakovic, P. Mahadevan, A. Vahdat, K. E. Bassler, Z. Toroczkai, M. Boguná, G. Caldarelli, et al., Nature communications 6, 8627 (2015).
- Bassler et al. [2015] K. E. Bassler, C. I. Del Genio, P. L. Erdős, I. Miklós, and Z. Toroczkai, New Journal of Physics 17, 083052 (2015).
- Van Koevering et al. [2021] K. Van Koevering, A. Benson, and J. Kleinberg, in The Web Conference 2021 (2021) pp. 367–378.
- Newman [2009] M. E. Newman, Physical review letters 103, 058701 (2009).
- Zha et al. [2001] H. Zha, X. He, C. Ding, H. Simon, and M. Gu, in CIKM (2001) pp. 25–32.
- Preti et al. [2022] G. Preti, G. de Francisci Morales, and M. Riondato, in ICDM (IEEE, 2022) pp. 418–427.
- Berge [1970] C. Berge, in Combinatorial Theory and its Applications I, Colloquia Mathematica Societatis János Bolyai, Vol. 4 (1970) pp. 119–133.
- Saracco et al. [2015] F. Saracco, R. Di Clemente, A. Gabrielli, and T. Squartini, Scientific reports 5, 1 (2015).
- Neal et al. [2023] Z. Neal, A. Cadieux, D. Garlaschelli, N. J. Gotelli, F. Saracco, T. Squartini, S. T. Shutters, W. Ulrich, G. Wang, and G. Strona (2023), arXiv 2310.01284.
- Ryser [1963] H. J. Ryser, Combinatorial mathematics, Vol. 14 (American Mathematical Soc., 1963).
- Carstens [2015] C. J. Carstens, Physical Review E 91, 042812 (2015).
- Verhelst [2008] N. D. Verhelst, Psychometrika 73, 705 (2008).
- Wang [2020] G. Wang, Electronic Journal of Statistics 14, 1690 (2020).
- Kannan et al. [1999] R. Kannan, P. Tetali, and S. Vempala, Random Structures & Algorithms 14, 293 (1999).
- Strona et al. [2014] G. Strona, D. Nappo, F. Boccacci, S. Fattorini, and J. San-Miguel-Ayanz, Nature communications 5, 1 (2014).
- Nishimura [2017] J. Nishimura, arXiv preprint arXiv:1704.01951 (2017).
- Cafieri et al. [2010] S. Cafieri, P. Hansen, and L. Liberti, Physical Review E 81, 046102 (2010).
- Artzy-Randrup and Stone [2005] Y. Artzy-Randrup and L. Stone, Physical Review E 72, 056708 (2005).
- Tabourier et al. [2011] L. Tabourier, C. Roth, and J.-P. Cointet, ACM Journal of Experimental Algorithmics 16, 7:1 (2011).
- [25] See Supplemental Material at URL-will-be-inserted-by-publisher for proofs and algorithmic details.
- Chen et al. [2005] Y. Chen, P. Diaconis, S. P. Holmes, and J. S. Liu, Journal of the American Statistical Association 100, 109 (2005).
- Miller and Harrison [2013] J. W. Miller and M. T. Harrison, The Annals of Statistics 41, 10.1214/13-aos1131 (2013).
- Holmes and Jones [1996] R. Holmes and L. Jones, The Annals of Statistics , 64 (1996).
- Miklós and Podani [2004] I. Miklós and J. Podani, Ecology 85, 86 (2004).
- Snijders [1991] T. A. Snijders, Psychometrika 56, 397 (1991).
- Czabarka et al. [2015] É. Czabarka, A. Dutle, P. L. Erdős, and I. Miklós, Discrete Applied Mathematics 181, 283 (2015).
- Robins et al. [2007] G. Robins, P. Pattison, Y. Kalish, and D. Lusher, Social networks 29, 173 (2007).
- Bollobás [1980] B. Bollobás, European Journal of Combinatorics 1, 311 (1980).
- Erdős et al. [2009] P. L. Erdős, I. Miklós, and Z. Toroczkai, arXiv preprint arXiv:0905.4913 (2009).
- Kim et al. [2012] H. Kim, C. I. Del Genio, K. E. Bassler, and Z. Toroczkai, New Journal of Physics 14, 023012 (2012).
- Chung and Lu [2002] F. Chung and L. Lu, Proceedings of the National Academy of Sciences 99, 15879 (2002).
- Squartini and Garlaschelli [2011] T. Squartini and D. Garlaschelli, New Journal of Physics 13, 083001 (2011).
- Squartini et al. [2015] T. Squartini, R. Mastrandrea, and D. Garlaschelli, New Journal of Physics 17, 023052 (2015).
- Brissette and Slota [2022] C. Brissette and G. Slota, in Proceedings of the Tenth International Conference on Complex Networks and Their Applications (Springer, 2022) pp. 451–462.
- Snijders et al. [2006] T. A. Snijders, P. E. Pattison, G. L. Robins, and M. S. Handcock, Sociological methodology 36, 99 (2006).
- Vallarano et al. [2021] N. Vallarano, M. Bruno, E. Marchese, G. Trapani, F. Saracco, G. Cimini, M. Zanon, and T. Squartini, Scientific Reports 11, 10.1038/s41598-021-93830-4 (2021).
Appendix A Proofs
Our main result, Theorem 1, relies on the following lemma.
Lemma 1.
For any bipartite graph with , for each , and any , it holds
with equality if and only if there exists , s.t. .
The meaning of this Lemma is that, when all nodes in have degree at most 2 , each node can be part of at most one butterfly for each unordered pair of ’s neighbors. Specifically, if either or has degree , then there can be no butterfly involving , , and another node in . If both and have degree , there may be at most one butterfly involving , , and another node in . If any node in has degree , a pair of neighbors of could be part of more than one butterfly together with (at most ).
We use the following technical lemma in the proof of Lemma 1.
Lemma 2.
Let , . For any sequence of strictly positive naturals s.t. , it holds
Proof.
Assume by contradiction that there exists a sequence of strictly positive naturals s.t. and for which
(3) |
It holds
where the inequality comes from the fact that for any , . Expanding the r.h.s. of the last inequality, we obtain
(4) |
which is clearly impossible because the ’s are strictly positive, thus the second term on the leftmost side is strictly positive. Thus we reached a contradiction, and the sequence cannot exists. ∎
Proof of Lemma 1.
We start by showing that if as in the thesis exists, then . Such a must be unique, due to the restrictions on the degree of the nodes in . It must then hold that for any , as all have degree exactly two and . From this fact and Fact 1, we get that for any , and that , as from the hypothesis. The desired equality follows from these facts and the definition of from Equation (1) in the main text.
We now show that if as in the thesis does not exists, it must be . Assume that there is exactly one s.t. . Then it must be , otherwise would be as in the thesis, which we just said can not happen. Then, from Fact 1, we get . From this fact, the fact that for any , and Eq. (1) from the text, we obtain the desired result.
Assume instead that there are distinct nodes s.t. . The desired result follows from Lemma 2 using , . ∎
Proof of Theorem 1.
Let and be the graphs output by Alg. 1 with inputs and . For completeness, let us recall the five properties satisfied by such graphs.
-
1.
and have left nodes (denoted with the letter ) and right nodes (denoted with the letter );
-
2.
and have the same left and right degree sequences. In particular, and have degree , and have degree , and have degree , has degree 2 for , and all the other left and right nodes have degree ;
-
3.
;
-
4.
, which, with the previous point, implies that and belong to all butterflies in , and every other node belongs to no butterfly;
-
5.
, , , which implies, with point 2, that and do not belong to all butterflies in .
For each , we denote with the graph obtained from the application of to . By definition of -BSO, each has the same left and right degree sequences, and . We set .
From properties 4 and 5 of and listed above, there must be an index s.t. in the graph , and share neighbors. We now show that and must share exactly neighbors in , i.e., .
Assume by contradiction that . Then, . From Equation (2) in the main text, given the degree sequence of the nodes in , we can write
(5) |
It then must be
(6) |
It holds
as some butterflies may be counted twice in the sum on the r.h.s.. From Lemma 1 applied to each of , , , and , it holds that
(7) |
Consider for now the case . If we can show that
(8) |
then we would have reached a contradiction, because this inequality, together with Eq. 7, implies that Eq. 6 cannot be true. The r.h.s. of Eq. 8 decreases as increases, so if we can show that Eq. 8 holds for the maximum value of , then it would hold for all . For , we can rewrite Eq. 8 as
(9) |
which is true for any , i.e., for all possible values of and . Thus we reached a contradiction and it cannot be .
Consider now the case . In this case,
Using this fact and Eq. 6, we can write
(10) |
Now, since and , it must hold
(11) |
because and can share at most two neighbors each in with one of , , , and . Due to the limitations on the degree of the nodes in , if any of , shares a neighbor with any , , then cannot share the same neighbor with any other of . Thus, combining Eq. 10 and Eq. 11, we get that
(12) |
It holds
where the last inequality comes from Eq. 7. Combining the above with Eq. 12 we obtain
which is only true for . But from our hypothesis on and , it must be , so we reached a contradiction, and it cannot be .
Thus, it must be , i.e., . We now show that the remaining butterflies in are s.t. and both belong to of them, and and both belong to of them. In other words , , and for any other .
Clearly, it must hold because and can each at most share one neighbor with any of , , which is not sufficient to obtain any butterfly to which both and or both and may belong. Thus, it must hold
We also have
where the last inequality comes from Eq. 7. To obtain equality, it must hold
From Lemma 1, we have that
with equality only if each of , , , and shares all its neighbors with another one of them. Thus, it must be that shares all its neighbors with , and that shares all its neighbors with , leading to the desired results that , , , and for any other .
At step , the number of common neighbors between and increases to , meaning that the number of butterflies involving the pair increases by . Since , the -BSO must transform all the butterflies in to which and do not already belong, into an equal number of butterflies in to which both and belong.
To this end, must swap at least
-
edge involving (or ) to connect (or to a node in (or in ): this way, , i.e., and will share neighbors in ;
-
edges involving either or to reduce the number of neighbors shared by these two nodes by at least : this way , implying ; and
-
edges involving either or to reduce the number of neighbors shared by these two nodes by at least : this way and thus .
Thus, must have the following properties:
-
must contain at least edges with and s.t. the edge has . Indeed if that was not the case, the edge would already exist in , because, as previously discussed, and share all their neighbors in . Thus, must contain, in addition to the edges as above, another edges whose endpoint in is neither nor . Additionally, of these edges, only at most may have either or as endpoint in , as if there were more, then there would be and that would share at least two neighbors in , and therefore it would be , which cannot be. is only required to have edges in the form ) with , thus really only at most can be as above.
-
Similarly, must contain at least edges with and s.t. the edge has . Indeed if that was not the case, the edge would already exist in , because, as previously discussed, and share all their neighbors in ; Thus, must contain, in addition to the edges as above, another edges whose node in is neither nor . Additionally, of these edges, only at most may have either or as endpoint in , as if there were more, then there would be and that would share at least two neighbors in , and therefore it would be , which cannot be.
Thus, must contain at least edges. For any value of , this quantity is at least . We then have , where the last inequality comes from the definition of . This fact concludes the proof. ∎
Appendix B Bipartite Graph Generator
We present our algorithm to generate the two bipartite graphs and used in the proof of our main result.
The algorithm (pseudocode in Alg. 1) receives in input two naturals , and generates two bipartite and with the same left and right degree sequence and each with butterflies, where .
The algorithm starts with the creation of the set of left nodes (any node in this set will be denoted as , for some ) and of right nodes (any node in this set will be denoted as , for some ), equal for both graphs. Then, it populates the edge set of and the edge set of . In , the butterflies involve three pairs of left nodes: , , and . Nodes and have degree and share neighbors (line 1); nodes and have degree and share neighbors (line 1); and nodes and have degree and share neighbors (line 1). In , the butterflies involve only the left nodes and , which share neighbors (line 1).
We will construct the two edge sets so that any other pair of left nodes share at most one neighbor. Thus, it hols that . Nodes and have degree in both graphs, but, so far, in we have added only edges to them. Similarly, node have degree in , but, so far, in it is connected to only one left node. Therefore, we insert in one edge involving , one edge involving (we connect them to different right nodes to avoid creating other butterflies between them), and one edge involving (line 1). The construction of is completed the addition of up to isolated edges, i.e., edges not connected with any other edge (line 1). These edges do not participate in any butterfly, because they involve nodes with degree . They are needed to guarantee that and have the same degree sequences, as it will become evident as we outline the other edges included in .
We add edges to in such a way that the pairs of vertices and have no more than one neighbor in common, so they do not belong to any butterfly. The idea is to (i) connect both and to (line 1), (ii) divide the remaining nodes to which is connected in into two groups and with , and (iii) insert into one edge between and each node in the first group, and one edge between and each node in the second group (line 1). Similarly, to ensure that and only have one neighbor in common, we (i) connect both and to (line 1), (ii) divide the remaining nodes to which is connected in into two groups and with , and (iii) insert into one edge between and each node in the first group, and one edge between and each node in the second group (line 1). So far, in we have added only of the neighbors that and must have, and only of the neighbors that and must have. Thus, we include edges to different right nodes (to avoid creating butterflies between them) for and (line 1), and edges to different right nodes for and (line 1). Similarly, so far we have added only one edge to the right nodes , and up to one edge to the right nodes and . In fact, depending on the value of and , such nodes are included/excluded from the group of nodes connected to and , respectively. Since all these nodes have degree in , we add the missing edges to (lines 1–1). Lastly, nodes and have degree in , and thus they must be connected to one neighbor also in (line 1). Finally, the two graphs and are returned.
Appendix C Connecting Arbitrary Bipartite Graphs in the State Space via -BSO
This section shows how to build a -BSO that transforms an arbitrary bipartite graph into another arbitrary graph with the same left and right degree sequences and number of butterflies. The -BSO needs to swap all links except those that are in common between the two graphs, i.e., . Let be the list of edges in common to the two graphs, the list of edges of , the list of edges of , and the number of edges unique to . We now show a -BSO operation that transforms into . We build the derangement incrementally, denoting with the current (i.e., as is being built) image of . At the beginning of the construction process, , and at the end, . For each , let and be any index such that and . Then, we set . The index must always exist because and have the same degree sequences.