Configuration models as an urn problem

A fundamental issue of network data science is the ability to discern observed features that can be expected at random from those beyond such expectations. Configuration models play a crucial role there, allowing us to compare observations against degree-corrected null-models. Nonetheless, existing formulations have limited large-scale data analysis applications either because they require expensive Monte-Carlo simulations or lack the required flexibility to model real-world systems. With the generalized hypergeometric ensemble, we address both problems. To achieve this, we map the configuration model to an urn problem, where edges are represented as balls in an appropriately constructed urn. Doing so, we obtain the generalized hypergeometric ensemble of random graphs: a random graph model reproducing and extending the properties of standard configuration models, with the critical advantage of a closed-form probability distribution.


Introduction
Important features of real-world graphs are often analysed by studying the deviations of empirical observations from suitable random models. Such models, or graph ensembles, are built so that some of the properties of the analysed empirical graph are preserved. Then, one can identify which other features of the empirical graph can be expected at random and which cannot, given the encoded constraints.
The simplest random graph model, named after Erdös and Rényi, generates edges between a given number of vertices with a fixed probability p ∈ (0, 1] [10]. In this model, the properties of vertices, such as their degrees, have all the same expected arXiv:1810.06495v1 [math.PR] 15 Oct 2018 G. Casiraghi, V. Nanumyan Generalised hypergeometric ensembles of random graphs 2/18 value. However, most empirical graphs have heterogeneous, heavy tailed degree distributions [1,13,8,2]. Hence, random graph models able to incorporate arbitrary degree sequences are of special importance. The most common model fixing only degree sequences is known as the configuration model of random graphs [8,9,3,14]. The comparison of an empirical graph with the corresponding configuration model then allows to quantify which properties of the original graph can be ascribed to the degree sequence. The properties not explained by the degree sequence highlight the unique structure of the studied empirical graph. The standard configuration model has a crucial drawback: the lack of analytical tractability. In fact, the model is realised by means of a repeated rewiring procedure. Each vertex is assigned a number of half-edges, or stubs, corresponding to their degree and one random realisation of the model is obtained by wiring pairs of stubs together uniformly at random. This is a computationally expensive procedure, which does not allow to explore the whole probability space of the model. This problem is exacerbated in the case of larger graphs and graphs with highly heterogeneous degree distributions.
Moreover, the standard configuration model is limited to the coarse analysis of the combinatorial randomness arising from vertex degrees, as it has no free parameters. While it has been invaluable for the macroscopic and the mesoscopic analysis of graphs, such as for graph partitioning through modularity maximisation [16] and for quantifying degree correlations [17], other graph models are needed to address complex dyadic patterns beyond degrees.
In this article, we propose a novel analytically tractable model for random graphs with given expected degree sequences. The formulation of the model relies on mapping the process of drawing edges to a multivariate urn problem. In its simplest case, our model corresponds to the configuration model for directed or undirected multi-edge graphs, fixing in expectation the values of vertex degrees instead of their exact values. In the general case, the model incorporates a parameter for each pair of vertices, which we call edge propensity. This parameter controls the relative likelihood of drawing an individual edge between the respective pair of vertices, as opposed to any other pair. This is achieved by biasing the combinatorial edge drawing process. The proposed formulation allows to model and test for arbitrary graph patterns that can be reduced to dyadic relations.
We indicate with A the adjacency matrix of the graph where entries A ij ∈ N 0 capture the multiplicity of an edge (i, j) ∈ V × V in the multi-set E. In the case of undirected graphs, the adjacency matrix is symmetric, i.e. A = A T , and the elements on its diagonal equal twice the multiplicity of the corresponding self-loops.
Definition 3 (Degrees). For each vertex i ∈ V the in-degree k in i := j∈V A ji and the out-degree k out i := j∈V A ij . The total number of multi-edges is expressed as m = i,j∈V A ij = i∈V k out i = j∈V k in j . We denote the in-degree and out-degree sequence of a directed graph G as k in (G) = {k in i } i∈V and k out (G) = {k out i } i∈V . We denote with k in/out i (G) the i-th entry of the degree sequence k in/out (G), corresponding to the in-or out-degree of vertex i. For undirected graphs, the adjacency matrix is symmetric and thus k in i = k out i =: k i . Hence, there is one degree sequence of an undirected graph, which we denote k(G).
As we only deal with multi-graphs, we will refer to multi-graphs simply as graphs in the rest of the article.

Soft Configuration Model
The concept underlying our random graph model is the same as for the standard configuration model of Molloy and Reed [14,15], which is to randomly shuffle the multiedges of a graph G while preserving vertex degrees. The standard configuration model generates multi-edges one after another by sampling uniformly at random a vertex G. Casiraghi, V. Nanumyan Generalised hypergeometric ensembles of random graphs 4/18 with an available out-stub (outwards half-edge) and a vertex with an available in-stub (inwards half-edge), until all stubs are consumed. Figure 1 illustrates one step of this process. The resulting random graphs all have exactly the same degree sequence as the original graph G. All pairs of available in-and out-stubs are equiprobable to be picked, so are the corresponding individual multi-edges. Therefore, the probability to observe a multi-edge between a given pair of vertices positively relates to the number of possible stub pairings of the two vertices, which in turn is defined by the corresponding degrees of these. In fact, this probability depends only on the degrees of the two vertices and on the total number of multi-edges in the graph. In the former case, once the out-stub (A, ·) has been sampled for rewiring, then one in-stub is sampled uniformly at random from those available, to draw a new multi-edge. If we represent each possible combination of an out-stub and an in-stub as a ball, we arrive at the urn problem without replacement. For the shown vertices, the odds of observing a multi-edge (A, B) are three times higher than of observing a multi-edge between (A, D) and 1.5 times higher than of observing a multi-edge between (A, C) in both model representations.
The need to consequently sample two vertices at each step makes it cumbersome to analytically formulate the procedure described above. To overcome this challenge, we take an edge-centric approach of sampling m multi-edges from a certain larger multi-set, which we define below in Definition 4. As a consequence of this change of perspective the model will preserve the expected degree sequences instead of the exact ones. To this end, we introduce the definition of the soft configuration model.
For each pair of vertices i, j ∈ V , we define the number Ξ ij of stub combinations that exist between vertices i and j, which can be conveniently represented in matrix form: G. Casiraghi, V. Nanumyan Generalised hypergeometric ensembles of random graphs

5/18
Definition 4 (Combinatorial matrix). We define combinatorial matrix Ξ ∈ N n × N n for graph G as the matrix whose elements Ξ ij are defined as where k out (G) and k in (G) are the out-degree and in-degree sequences of the graph G.

Soft configuration model for directed graphs
Definition 5 (Directed soft configuration model). Letk in ,k out ∈ N n be in-and outdegree sequences andV a set of n vertices. The soft configuration model X generated by (V ,k in ,k out ) is the n 2 -dimensional random vector X defined on the probability space (S, P ) with sample space with some probability measure P , such that the expected degree sequences of a realisation of X are fixed: This set-up allows to map the model to an urn problem and thus to arrive to a closedform probability distribution function for it.
Lemma 1 (Number of stub combinations). The combinatorial matrix Ξ ∈ N n × N n given in Definition 4 encodes the numbers of out-stub and in-stub combinations for each pair of vertices, given degree sequences k out and k in .
Proof. Let k out i be the out-degree of vertex i and k in j the in-degree of vertex j. The number of out-stubs of a vertex corresponds to its out-degree. Similarly, the number of in-stubs of a vertex corresponds to its in-degree. Each one of the k out i out-stubs can be connected to all k in j in-stubs. Hence, the total number of stub combinations between vertices i and j Ξ ij is equal to k out i k in j .
We further introduce the concept of induced random model.
Definition 6 (Graph-induced random model). We say that the graph G(V , E) induces the random model X, if the quantities (V ,k in ,k out ) generating X are computed from G. I.e.,V = V ,k in = k in (G), andk out = k out (G).

G. Casiraghi, V. Nanumyan
Generalised hypergeometric ensembles of random graphs 6/18 Under this assumption, we can formulate the following theorem for the distribution of the soft configuration model X. To keep the notation simple, we will not distinguish between the n × n adjacency matrix A and the vector of length n 2 obtained by stacking it by row or column. Similarly, we do the same for all other related n × n matrices.
Theorem 2. Let G(V , E) be a directed graph with n = |V | vertices and m = |E| multi-edges. Let k in (G) ∈ N n and k out (G) ∈ N n be the vectors representing its in-degree and out-degree sequences. Let X be the soft configuration model induced by G defined as in Definition 5. If the probability measure P depends only on the degree sequences in G and the total number of multi-edges m = |E| and all multi-edges are equiprobable, then X follows the multivariate hypergeometric distribution as in Eq. (4).
Let A ∈ N n 0 × N n 0 be an adjacency matrix and Ξ ∈ N n × N n be the combinatorial matrix induced by G. Then the soft configuration model X is distributed as follows: where M = i,j∈V Ξ ij is the total number of stub combinations between all vertices.
Proof. We want to sample m multi-edges connecting any of the in-and out-stub pairs such that all such such multi-edges are equiprobable. According to Lemma 1, the total number of stubs combinations between any two vertices i, j is given by Ξ ij . We can hence define the random graph model as follows. We sample m multi-edges without replacement from the multi-set of size i,j∈V Ξ ij that combines all the possible stub pairs combinations Ξ ij between all pairs i, j ∈ V . We sample without replacement because we need to mimic the process of wiring stubs. Once a stub pair has been used it cannot be sampled again. We can view this model as an urn problem where the edges to be sampled are represented by balls in an urn. By representing the multi-edges connecting each different pair of vertices (i, j) as balls of a unique colour, we obtain an urn with a total of M = i,j∈V Ξ ij balls of n 2 = |V × V | different colours. With this, the sampling of a graph according to our model corresponds to drawing exactly m balls from this urn. Each adjacency matrix A with i,j∈V A ij = m corresponds to one particular realisation drawn from this model. The probability to draw exactly A = {A ij } i,j∈V edges between each pair of vertices is given by the multivariate hypergeometric distribution.
From Theorem 2 we derive the following results, whose proofs follow directly from properties of the hypergeometric distribution.
Corollary 2.2. The expected in-and out-degree sequences of realisations of the directed soft configuration model X correspond to the respective degree sequences of the graph G inducing X.
Proof. For each pair of vertices i, j we can calculate the expected number of multi-edges Moreover, summing the rows and columns of matrix E X ij and assuming directed graphs with self-loops we can calculate the expected in-or out-degrees of all vertices as Equation (7) confirms that the expected in-and out-degree sequence of realisations drawn from X corresponds to the degree sequence of the given graph G.

Soft configuration model for undirected graphs
So far we have discussed the configuration model for directed graphs. Specifying the undirected case, on the other hand, requires some more efforts. The reason for this is that, under the assumptions described in the previous section, the undirected version of the soft configuration model is the degenerate case of its directed counterpart, where the direction of the multi-edges is ignored. In particular, this implies that the random vector corresponding to the undirected model has half the dimensions of the directed one, because any undirected multi-edge between two vertices i and j can either be generated as a directed multi-edge (i, j) or as a directed multi-edge (j, i).

8/18
Definition 7 (Undirected soft configuration model). Letk ∈ N n be a degree sequence andV a set of n vertices. The soft configuration model X generated by (V ,k) is the (n 2 + n)/2-dimensional random vector X defined on the probability space (S, P ), for the sample space with some probability measure P , such that the expected degree sequence of a realisation of X is fixed: At first sight, it would appear that the undirected soft configuration model can simply be obtained by restricting the directed model to n(n + 1)/2 components corresponding to the upper-triangle and the diagonal of the adjacency matrix. That is, we would sample m multi-edges among pairs i ≤ j ∈ V from the multi-set of stub combinations Ξ ij as defined in Eq. (1). However, the resulting model does not satisfy Definition 7, because its expected degree sequence does not equal the degree sequence that induced it. To show this, we follow the same reasoning adopted in the proof of Corollary 2.2.
This approach is wrong because the total number of undirected stub combinations is larger than in the directed case. The reason for this is the symmetry in the process of wiring two stubs. Letk i be the degree of vertex i andk j the degree of vertex j. To form a multi-edge (i, j), each one of thek i stubs of i can be connected to allk j stubs of j, and vice versa, each of thek j stubs of j can be connected to allk i stubs of i. Hence, the total number of combinations of stubs between vertices i and j equals tok ikj +k jki = 2k ikj .
As an equivalent to Lemma 1, we formalise this in the following lemma.
Lemma 3 (Undirected stubs combination count). The total number of stub combinations between two vertices i, j in an undirected graph is given by: We can now formulate the equivalent of Theorem 2 for the undirected case. The distribution underlying the undirected soft configuration model can then be computed analogously to Theorem 2 with the help of Lemma 3.

9/18
Theorem 4. Let G(V , E) be an undirected graph with n = |V | vertices and m = |E| multiedges. Let k ∈ N n be the vector representing its degree sequence. Let X be the undirected soft configuration model induced by G defined as in Definition 7. If the probability distribution underlying X depends only on the degree sequence of G and the total number of multi-edges m, and all multi-edges are equiprobable, then X follows the multivariate hypergeometric distribution given in Eq. (11).
Let A ∈ N n 0 × N n 0 be the symmetric adjacency matrix corresponding to an undirected graph, and Ξ ij = k i k j be the combinatorial matrix induced by G. Then the undirected soft configuration model X is distributed as follows: where M = i<j∈V 2Ξ ij + l∈V Ξ ll = i,j∈V Ξ ij is the total number of undirected stub combinations between all pair of vertices.
Proof. The proof follows the same reasoning of the proof of Theorem 2, accounting for the fact that the total number of stubs combinations is now given by Eq. (10).
Corollary 4.2. The expected degree sequence of realisations of X correspond to the respective degree sequences of the graph G inducing X.
Proof. For each pair of vertices i, j ∈ V , the expected number of multi-edges E X ij according to the hypergeometric distribution in Eq. (11) is expressed as With this, we can write the expected degrees as

Correspondence between directed and undirected models
In the previous two sections, we have formulated the soft configuration model for directed and undirected graphs independently of each other. As the reader recalls, we have motivated these models by the need of an analytically tractable analogy for the rewiring algorithm of the Molloy-Reed model [14]. This algorithm is the same in the directed and undirected case: select the first stub (outgoing, in the directed case), then select the second stub (incoming, in the directed case), create an edge by wiring these two stubs, and repeat the process until all the stubs are wired. Hence, we also show the correspondence between our directed and undirected formulations in this section.
We prove that the probability distribution of undirected graphs in the undirected soft configuration model given by Eq. (11) is a degenerate case of the directed model given by Eq. (4).
With the following definition we provide a projection from N n 2 to N n(n+1)/2 that serves the purpose mapping a directed graph to its undirected equivalent, i.e., stripping the direction from its edges.
Definition 8 (Undirected projection). Let G (V , E ) be a directed graph with adjacency matrix A . We define as undirected projection the map π : N n 2 → N n(n+1)/2 that maps G to the undirected graph G(V , E) with adjacency matrix A = A + A T . We indicate with G → G the fact that G = π(G ).
According to Definition 8 there are different directed graphs that can be projected to the same undirected graph. At the same time, every undirected graph has at least one corresponding directed graph that can be projected to it, and for every directed graph there is at least one undirected graph to which it can be projected. These make the projection in Definition 8 surjective and not injective.
Similarly, we can define an undirected random graph model as the projection of a directed random graph model.

Definition 9.
Let X be a directed random graph model. With an abuse of notation, we use X T to refer to the transposition of the matrix representation of X . We say that X := X + X T is the undirected projection of X if ∀G in the sample space of X exists a G in the sample space of X such that the undirected projection π(G ) of G is G. Furthermore, for every undirected graph G in the sample space of X, ∃G such that π(G ) = G. We indicate with X → X the fact that X is the undirected projection of X .
Note that according to Definition 8, the number of multi-edges m of G equals the number of multi-edges of any directed G that projects to G.

11/18
Finally we need to relate the distribution underlying a directed random graph model to the the distribution of its undirected projection. The following lemma serves this purpose.
Lemma 5. Let G be an undirected graph and X an undirected random graph model. Let X be a directed random graph model such that X → X. The probability distribution of X, Pr(X = G), is given as: where the set π −1 (G) = G |G → G is the set of all directed graphs G that map to G.
Proof. Let X be a n 2 −dimensional random vector formalising a directed random graph model, such that X → X. For simplicity we index the elements of both random vectors as in the equivalent adjacency matrix notation. Let X ij = X ji the ij-th element of X and X ij , X ji the corresponding elements of X .
According to Definition 9, X is the n(n + 1)/2-dimensional random vector defined as X + X T , where its each element ij is defined as X ij = X ij + X T ji . The probability distribution of X, Pr(X = G) = f X (G) can be specified in terms of the probability distribution f X (G ) = Pr(X = G ): The summation in Eq. (16) corresponds to the sum over the probabilities of all possible combinations of tuples X ij , X ji which sum to A ij for all indices ij. Hence, following Definition 8, this is equivalent to sum over all possible G → G. This proves the equivalence between Eq. (16) and Eq. (15) and thus, the lemma.
We can proceed showing that the undirected version of the soft-configuration model given in Theorem 2 is indeed equivalent to the model defined in Theorem 4. Theorem 6 stems from the fact that sampling an undirected edge between two vertices is equivalent to sampling a directed edge between the same pair of vertices in any of the two directions, and then stripping its direction information. The distribution underlying the undirected soft configuration model can then be computed with the help of Lemma 5.
Theorem 6. Let G be an undirected graph and X the undirected soft-configuration model. Let X be the directed soft configuration model with combinatorial matrix with elements Ξ ij = k i k j . The probability distribution of X is then given by Eq. (11).
Proof. The distribution of X is given by the hypergeometric distribution in Eq. (4).
The model X satisfies the conditions in Lemma 5 for the undirected soft configuration model X, because X maps to the undirected soft configuration model X in accordance with Definition 9. Hence, we write the probability distribution underlying X as the sum of the probabilities of all corresponding directed graphs G under the directed soft configuration model X .
In Eq. (20) we have n(n−1)/2 summations for all A ij , i < j, which are the decomposition of the summation in Eq. (19). Then, we can swap the summations and multiplications in Eq. (20), which leads to From Vandermonde's identity, which states and from the fact that A ii = A ii /2, ∀i ∈ V , it follows that Eq. (21) is equivalent to Eq. (11).
In the two sections above we have provided a parsimonious formulation of the softconfiguration model in terms of an hypergeometric ensemble. The ensemble provides a random graph model formulation for directed and undirected graphs alike, in which (i) the expected in-and out-degree sequences are fixed, and (ii) multi-edges between these vertices with fixed expected degrees are formed uniformly at random. More precisely, the probability for a particular pair of vertices to be connected by an edge is only influenced by combinatorial effects, and thus only depends on the degrees of the vertices and the total number of edges.  Figure 2: The effect of edge propensities on the configuration model. Differently from the standard configuration model, here the stubs are not sampled uniformly at random (cf. Fig. 1). Given an out-stub, each in-stub is characterised by a propensity Ω ij of being chosen. As a result, the probability of wiring the out-stub (A, ·) to the vertex D is larger than that of B due to a very large edge propensity Ω AD , even though vertex B has three times more in-stubs than vertex D.

Generalised Hypergeometric Ensemble of Graphs
As described above, the hypergeometric ensemble of random graphs samples edges uniformly at random from the urn containing all possible edges. However, such uniform sampling of edges is generally not enough to describe real graphs. In fact, in empirical graphs edge probabilities do not only depend on the activity of vertices (represented by their degrees) but also on other characteristics. Examples of such characteristics are vertex labels that lead to observable group structures, distances between vertices, etc. Below we introduce how such influences on the sampling probabilities of edges can be encoded in a random graph model by means of a dyadic property we call edge propensity.
First, we introduce the concept of edge propensity. Given two dyads (i, j) and (k, l) ∈ V × V where Ξ ij = Ξ kl , according to the soft-configuration model of Section 2.1 the probabilities of sampling one multi-edge between (i, j) and (k, l) are equal, leading to odds-ratio of 1 between the two pairs of vertices. Instead, we generalise the model in a way that fixing arbitrary odds-ratios is possible. That is, we define the aforementioned edge propensities such that the ratio between them is the odds-ratio of sampling one multi-edge between the two corresponding vertex pairs, all else being equal. We use edge propensities to bias the sampling probability of each multi-edge, as illustrated in Fig. 2. This way, the probability of the number of multi-edges between a pair of vertices depends on both the degrees of the vertices and their edge propensity.
We encode edge propensities in a matrix Ω defined as follows.
G. Casiraghi, V. Nanumyan Generalised hypergeometric ensembles of random graphs 14/18 Definition 10 (Propensity matrix). Let Ω = (Ω ij ) i,j∈V ∈ R |V |×|V | be a n × n matrix where n is the number of vertices. Let (i, j) and (k, l) ∈ V × V . Let ω ij,kl the odds-ratio of sampling one multi-edge between (i, j) instead of (k, l). The entries Ω ij and Ω kl of the propensity matrix Ω are then defined such that Ω ij /Ω kl = ω ij,kl . This implies that the propensity matrix Ω is defined up to a constant, as multiplying Ω with any constant preserves the specified odds-ratios. Now, we define a random graph model that combines the degree-related combinatorial effects, i.e., the configuration model, and the newly introduced edge propensities. We do so by using the propensities to bias the sampling process described in Section 2.1. In the urn model analogy, such biased sampling implies that the probability of drawing a certain number of balls of a given colour (i.e., multi-edges between the corresponding pair of vertices) depends both on their number and their size, as illustrated in Fig. 2. The probability distribution resulting from such a biased sampling process is given by the multivariate Wallenius' non-central hypergeometric distribution [18,11]. Let A ∈ N n × N n be the adjacency matrix associated with G and Ξ ∈ N n × N n be its combinatorial matrix defined in Eq. (1). Then the GHypEG defined by Ξ and Ω, G is distributed as follows: The distribution describing the biased sampling from an urn is a generalisation of the multivariate hypergeometric distribution. The proof of Theorem 7 follows from the fact that, when the sampling is performed without replacement with given relative odds, this sampling process corresponds to the multivariate Wallenius' non-central hypergeometric distribution. Details of this derivation can be found in [18] for the univariate case, and in [7,6] for the multivariate case. A thorough review of non-central hypergeometric distributions has been done in [12].
The next two corollaries directly follow from properties of Wallenius' non-central hypergeometric distribution.
Corollary 7.2. The entries of the expected adjacency matrix E X ij can be obtained by solving the following system of equations: with the constraint i,j∈V E X ij = m.
The undirected formulation of the GHypEG follows the same reasoning of Theorem 4, with the addition of a symmetric propensity matrix. That is, the distribution of the undirected generalised hypergeometric ensemble is hence given by a Wallenius' distribution similar to Eq. (23), but corresponding to the upper triangular part of the matrices (i.e., for i ≤ j) with Ξ defined according to Lemma 3.

Estimation of the propensity matrix
In this final section, we show how to define the propensity matrix Ω such that the expected graph E [X] from the model X defined by Ω coincides with an arbitrary graph G. By doing so, we create a random model centered around the inducing graph. The result is described in the following corollary, which follows from the properties of Wallenius' non-central hypergeometric distribution. Let Ω be a n × n propensity matrix, characterised by elements Ω ij with i, j ∈ V . Then, G coincides with the expectation E [X] of the GHypEG X induced by G and Ω if and only if the following relation holds.
Where Ξ is the combinatorial matrix associated with X and Ξ ij its elements.

G. Casiraghi, V. Nanumyan
Generalised hypergeometric ensembles of random graphs 16/18 Proof. Equation (28) follows directly from Corollary 7.1. In particular, when solving Eq. (27) for Ω with the assumption E [X] = A we obtain the following system of |V | 2 equations (in the case of a directed graph with self-loops) for |V | 2 + 1 variables.
The solution of this system is Eq. (28).
A wide range of statistical patterns that go beyond degree effects can be encoded in the graph model by specifying the matrix Ω of edge propensities. The encoding and fitting techniques of such arbitrary propensity matrices are beyond the scope of this article, and will not be discussed here. We refer to [4] for a general method to fit external dyadic data as propensities.
Finally, we show that the soft configuration model of Section 2.1 is a special case of generalised hypergeometric graph models. The soft configuration model described in Theorem 2 can be in fact recovered from the generalised model by setting all entries in the propensity matrix to the same value. By doing so, the odds-ratio between the propensities for any pair of vertices is 1, and the edge sampling process is not biased. Thus, the probability distribution of the model reduces to a function of the degree sequences and the number of multi-edges sampled.
Plugging this result in Eq. (23) we thus recover Eq. (4) for the unbiased case, i.e. where all edge propensities are identical.

Final remarks
We have proposed a novel approach for studying random graphs in terms of an urn problem. By doing so, we have arrived at an analytically tractable formulation of the widely used configuration model of random graphs. Furthermore, we have expanded the configuration model to the generalised hypergeometric ensemble, which is a whole new class of models that can incorporate arbitrary dyadic biases in the probabilities of sampling edges. Importantly, the analytical tractability of the generalised hypergeometric ensembles allows for robust model selection and hypothesis testing of various topological patterns in empirical data [5]. Moreover, one can perform a multiplex network regression [4] based on our model, in order to find the weighted combination of multiple relational layers that best describes the observed multi-graph. For instance, one can study how different social phenomena and environmental factors influence the topological patterns in repeated social interactions. The ability to analytically perform such statistical analysis opens new possibilities for the study of complex interaction data, which pervades many scientific disciplines.