# Configuration model

In network science, the Configuration Model is a family of random graph models designed to generate networks from a given degree sequence. Unlike simpler models such as the Erdős–Rényi model, Configuration Models preserve the degree of each vertex as a pre-defined property. This flexibility allows the modeler to construct networks with arbitrary degree distributions, making it widely used as a reference model for real-life networks, particularly in social, biological, and technological domains. The concept of "Configuration Model" was first introduced by Béla Bollobás, who laid the foundation for its application in graph theory and network science.
Part of a series on :
Network science :
Theory :
Graph
Complex network
Contagion
Small-world
Scale-free
Community structure
Percolation
Evolution
Controllability
Graph drawing
Social capital
Link analysis
Optimization
Reciprocity
Closure
Homophily
Transitivity
Preferential attachment
Balance theory
Network effect
Social influence :
Network types :
Informational (computing)
Telecommunication
Transport
Social
Scientific collaboration
Biological
Artificial neural
Interdependent
Semantic
Spatial
Dependency
Flow
on-Chip :
Graphs :
MetricsAlgorithms :
Centrality
Degree
Motif
Clustering
Degree distribution
Assortativity
Distance
Modularity
Efficiency :
Models :
ListsCategories :
Topics
Software
Network scientists
Category:Network theory
Category:Graph theory :
vte :

## Rationale for the model

The key advantage of the Configuration Model lies in its ability to decouple the degree sequence from specific edge generation processes. This makes it suitable for analyzing networks with heterogeneous degree distributions, such as scale-free networks, which exhibit heavy-tailed degree distributions. By preserving these structural properties, Configuration Models provide a null hypothesis for understanding the role of degree distributions in shaping network properties.
Configuration Models can be specified for different types of graphs:
* Simple graphs: Graphs without self-loops or multi-edges.
* Multi-edge graphs: Graphs allowing multiple edges between the same pair of nodes.
* Loopy graphs: Graphs that include self-loops (edges connecting a node to itself).
* Directed graphs: Models with specified in-degrees and out-degrees for each node.
* Undirected graphs: Models that consider the total degree of each node.

## Configuration Models

The family of Configuration Models can be categorized into two main groups:
* Microcanonical Configuration Models: Fix the degree sequence exactly.
* Canonical Configuration Models: Fix the degree sequence in expectation.

### Micro-Canonical Configuration Model

The Micro-Canonical Configuration Model is the most common variation of the configuration model. It exactly preserves the degree sequence of a given graph by assigning stubs (half-edges) to nodes based on their degrees and then randomly pairing the stubs to form edges.
The preservation of the degree sequence is exact in the sense that all realizations of the model result in graphs with the same predefined degree distribution. This variation is referred to as micro-canonical because it defines a uniform probability space where all possible graphs consistent with the given degree sequence are equally likely to be sampled. This approach ensures that the degree sequence is strictly maintained.
The model can be formalized as stub-labelled model, where stubs are explicitly labelled and paired; alternatively, it can be formalised as a vertex-labelled models, where edges between vertices are indistinguishable.

### Canonical Configuration Models

Canonical Configuration Models relax the exact degree sequence constraint and preserve it only in expectation. These models define probability distributions over the edges of the network. Canonical configuration models are often referred to as soft configuration models.

#### Chung-Lu Configuration Model

The Chung-Lu Configuration Model is a canonical configuration model variant for simple graphs (i.e., without multi-edges). It assumes that edges between nodes are independent from each other, differently from the micro-canonical model. The probability of an edge between nodes $i$ and $j$ is proportional to the product of their degrees and, in the case of a loopy undirected graph, is given by:
$p_{ij}={\frac {k_{i}k_{j}}{2m}},$
where $k_{i}$ and $k_{j}$ are the degrees of nodes $i$ and $j$, and $m$ is the total number of edges in the graph. In this formulation, the expected degree sequence matches the input degrees, but the actual degree sequence in any realization may vary slightly due to the probabilistic nature of edge formation.

##### Application: Modularity Calculation

The Chung-Lu configuration model, provides the benchmark in the calculation of network modularity. Modularity measures how well a network is divided into modules or communities, comparing the observed structure against a null model: the configuration model. The modularity is computed as:
$Q={\frac {1}{2L}}\sum _{i\neq j}{\BiglA_{ij}-{\frac {k_{i}k_{j}}{2L}}{\Bigr )}\delta (C_{i},C_{j}),$
where:
* $A_{ij}$ is the adjacency matrix of the observed network, with $A_{ij}=1$ if there is an edge between $i$ and $j$, and $A_{ij}=0$ otherwise.
* ${\frac {k_{i}k_{j}}{2L}}$ represents the expected probability of an edge between nodes $i$ and $j$ under the configuration model.
* $\delta (C_{i},C_{j})$ is the Kronecker delta, equal to 1 if nodes $i$ and $j$ are in the same module and 0 otherwise.
This equation compares the observed network to the configuration model, where edges are distributed based solely on the degree sequence. Modularity scores provide insights into the quality of community structures in the network, with higher scores indicating stronger modularity.
For further details, refer to the page on modularity.

#### Norros-Reittu Configuration Model

The Norros-Reittu Configuration Model extends the Chung-Lu configuration model by allowing for multi-edges between nodes. In this model, the number of edges between nodes $i$ and $j$ follows a Poisson distribution, given by:
$P(E_{ij}=k)={\frac {\lambda _{ij}^{k}e^{-\lambda _{ij}}}{k!}},$
where $\lambda _{ij}$ is the expected number of edges between nodes $i$ and $j$, defined as: $\lambda _{ij}={\frac {k_{i}k_{j}}{2m}}.$ Here: $k_{i}$ and $k_{j}$ are the degrees of nodes $i$ and $j$, respectively. $m$ is the total number of edges in the graph. As for Chung-Lu configuration model, nodes pairs are assumed to be independent from each other.

##### Connection to Degree-Corrected Stochastic Block Model

The Norros-Reittu Configuration Model is particularly important as it provides the degree correction for the Degree-Corrected Stochastic Block Model (DC-SBM). By incorporating the degree sequence into the edge probability, this model allows the DC-SBM to distinguish between structural patterns in communities and variations driven by node degrees. This degree correction ensures that the observed degree heterogeneity in networks does not bias the identification of community structures.

#### Casiraghi-Nanumyan Hypergeometric Configuration Model

The Casiraghi-Nanumyan Hypergeometric Configuration Model extends canonical configuration models by accounting for dependencies between edges. Unlike models assuming independent edge generation, this model uses a multivariate hypergeometric distribution to represent the probability of an entire graph configuration. This approach preserves the degree sequence while modeling competition for resources. The probability of observing a specific graph with adjacency matrix $A$ is given by:
$P(A)={\frac {\prod _{i<j}{\binom {2\Xi _{ij}}{A_{ij}}}\prod _{l}{\binom {\Xi _{ll}}{A_{ll}/2}}}{\binom {M}{m}}},$
where $A_{ij}$ is the number of edges between nodes $i$ and $j$, $\Xi _{ij}=k_{i}k_{j}$ represents the propensity for interaction between nodes $i$ and $j$ based on their degrees, $m$ is the total number of edges in the graph and $M=\sum _{ij}\Xi _{ij}=4m^{2}$.
This model captures resource competition by enforcing that the sum of interactions across all node pairs is fixed. Forming an edge between two nodes reduces the availability of resources for other connections, reflecting realistic constraints in systems like social or ecological networks. The model naturally generates multi-edges for any node pair $i$ and $j$ where $\Xi _{ij}>1$.

#### Configuration Model from Maximum Entropy Principles

Starting from the maximum entropy principle, one can generate another canonical configuration model, referred to as the soft configuration model. This model belongs to the family of exponential random graph models (ERGMs) and generates random graphs by constraining the expected degree sequence while maximizing the entropy of the graph model. The probability of a graph $G$ is given by:
$P(G)\propto \exp {\Bigl-\sum _{i}\theta _{i}k_{i}(G){\Bigr )},$
where $\theta _{i}$ are Lagrange multipliers ensuring the expected degree of node $i$ matches the target degree, $k_{i}(G)$ is the degree of node $i$ in the graph $G$.

## Generating from the Micro-Canonical Configuration Model

The following algorithm describes the generation of the model:
* Take a degree sequence, i. e. assign a degree $k_{i}$ to each vertex. The degrees of the vertices are represented as half-links or stubs. The sum of stubs must be even in order to be able to construct a graph ($\sum k_{i}=2m$). The degree sequence can be drawn from a theoretical distribution or it can represent a real network (determined from the adjacency matrix of the network).
* Choose two stubs uniformly at random and connect them to form an edge. Choose another pair from the remaining $2m-2$ stubs and connect them. Continue until you run out of stubs. The result is a network with the pre-defined degree sequence. The realization of the network changes with the order in which the stubs are chosen, they might include cycles (b), self-loops (c) or multi-links (d) (Figure 1).

### Self-loops, multi-edges and implications

The algorithm described above matches any stubs with the same probability. The uniform distribution of the matching is an essential property in calculating other features of the generated networks. The network generation process does not exclude the development of a self-loop or a multi-link. If we designed the process where self-loops and multi-edges are not allowed, the matching of the stubs would not follow a uniform distribution.
The expected total number of multi-links in a configuration model network would be:
${\frac {1}{2}}{\Big{\frac {\langle {k^{2}}\rangle }{\langle k\rangle }}-1{\Big ]}^{2}$
where $\langle {k^{n}}\rangle$ is the n-th moment of the degree distribution. Therefore, the average number of self-loops and multi-links is a constant for some large networks, and the density of self-loops and multi-links, meaning the number per node, goes to zero as $N\rightarrow \infty$ as long as $\langle {k^{2}}\rangle$ is constant and finite. For some power-law degree distributions where the second moment diverges, density of multi-links may not vanish or may do so more slowly than ${N}^{-1}$.
A further consequence of self-loops and multi-edges is that not all possible networks are generated with the same probability. In general, all possible realizations can be generated by permuting the stubs of all vertices in every possible way. The number of permutation of the stubs of node $i$ is $k_{i}!$, so the number of realizations of a degree sequence is $N\{k_{i}\}=\prod _{i}k_{i}!$. This would mean that each realization occurs with the same probability. However, self-loops and multi-edges can change the number of realizations, since permuting self-edges can result an unchanged realization. Given that the number of self-loops and multi-links vanishes as $N\rightarrow \infty$, the variation in probabilities of different realization will be small but present.

## Properties
### Edge probability

A stub of node $i$ can be connected to $2m-1$ other stubs (there are $2m$ stubs altogether, and we have to exclude the one we are currently observing). The vertex $j$ has $k_{j}$ stubs to which node $i$ can be connected with the same probability (because of the uniform distribution). The probability of a stub of node $i$ being connected to one of these $k_{j}$ stubs is ${\frac {k_{j}}{2m-1}}$. Since node $i$ has $k_{i}$ stubs, the probability of $i$ being connected to $j$ is ${\frac {k_{i}k_{j}}{2m-1}}$ (${\frac {k_{i}k_{j}}{2m}}$ for sufficiently large $m$). Note that this formula can only be viewed as a probability if $k_{i}k_{j}/2m\ll 1$, and more precisely it describes the expected number of edges between nodes $i$ and $j$. Note that this formula does not apply to the case of self-edges.
Given a configuration model with a degree distribution $p_{k}$, the probability of a randomly chosen node $i$ having degree $k$ is $p_{k}$. But if we took one of the vertices to which we can arrive following one of edges of i, the probability of having degree k is ${\frac {k}{2m}}\times np_{k}={\frac {kp_{k}}{\left\langle k\right\rangle }}$ . (The probability of reaching a node with degree k is ${\frac {k}{2m}}$, and there are $np_{k}$ such nodes.) This fraction depends on $kp_{k}$ as opposed to the degree of the typical node with $p_{k}$. Thus, a neighbor of a typical node is expected to have higher degree than the typical node itself. This feature of the configuration model describes well the phenomenon of "my friends having more friends than I do".

### Clustering coefficient

The clustering coefficient $C_{g}$ (the average probability that the neighbors of a node are connected) is computed approximately as follows:
    $C_{g}=\sum _{k_{i},k_{j}=1}^{\infty }q_{k_{i}}q_{k_{j}}{\frac {(k_{i}-1)(k_{j}-1)}{2m}},$
where $q_{k}$ denotes the probability that a random edge reaches a degree-$k$ vertex, and the factors of the form "$k_{i}-1$" rather than "$k_{i}$" appear because one stub has been accounted for by the fact that these are neighbors of a common vertex. Evaluating the above results in
    $C_{g}={\frac {1}{2m}}\left[\sum _{k=0}^{\infty }(k-1)q_{k}\right]^{2}.$
Using $q_{k}=kp_{k}/\langle k\rangle$ and $2m=N\langle k\rangle$, with $p_{k}$ denoting the degree distribution, $\langle k\rangle$ denoting the average degree, and $N$ denoting the number of vertices, the above becomes
    $C_{g}={\frac {1}{N\langle k\rangle ^{3}}}\left[\sum _{k=1}^{\infty }(k-1)kP(k)\right]^{2}={\frac {\left(\langle k^{2}\rangle -\langle k\rangle \right)^{2}}{N\langle k\rangle ^{3}}},$
with $\langle k^{2}\rangle$ denoting the second moment of the degree distribution. Assuming that $\langle k^{2}\rangle$ and $\langle k\rangle$ are constant, the above behaves as
    $C_{g}\sim {\frac {\mathrm {const} }{N}},$
where the constant depends on $p_{k}$. Thus, the clustering coefficient $C_{g}$ becomes small in the $N\gg 1$ limit.

### Giant component

In the configuration model, a giant component (GC) exists if
    $\langle k^{2}\rangle -2\langle k\rangle >0,$
where $\langle k\rangle$ and $\langle k^{2}\rangle$ are the first and second moments of the degree distribution. That means that, the critical threshold solely depends on quantities which are uniquely determined by the degree distribution $p_{k}$.
Configuration model generates locally tree-like networks, meaning that any local neighborhood in such a network takes the form of a tree. More precisely, if you start at any node in the network and form the set of all nodes at distance $d$ or less from that starting node, the set will, with probability tending to 1 as n → ∞, take the form of a tree. In tree-like structures, the number of second neighbors averaged over the whole network, $c_{2}$, is: $c_{2}=\langle k^{2}\rangle -\langle k\rangle .$
Then, in general, the average number at distance $d$ can be written as:
    $c_{d}=\left({\frac {c_{2}}{c_{1}}}\right)^{d-1}c_{1}.$
Which implies that if the ratio of ${\frac {c_{2}}{c_{1}}}$ is larger than one, then the network can have a giant component. This is famous as the Molloy-Reed criterion. The intuition behind this criterion is that if the giant component (GC) exists, then the average degree of a randomly chosen vertex $i$ in a connected component should be at least 2. Molloy-Reed criterion can also be expressed as: $\sum _{i}k_{i}(k_{i}-2)>0,$ which implies that, although the size of the GC may depend on $p_{0}$ and $p_{2}$, the number of nodes of degree 0 and 2 have no contribution in the existence of the giant component.

### Diameter

Configuration model can assume any degree distribution and shows the small-world effect, since to leading order the diameter of the configuration model is just $d={\frac {\ln(N)}{\ln(c_{2}/c_{1})}}$.

### Components of finite size

As total number of vertices $N$ tends to infinity, the probability to find two giant components is vanishing. This means that in the sparse regime, the model consist of one giant component (if any) and multiple connected components of finite size. The sizes of the connected components are characterized by their size distribution $w_{n}$- the probability that a randomly sampled vertex belongs to a connected component of size $n.$ There is a correspondence between the degree distribution $p_{k}$ and the size distribution $w_{n}.$ When total number of vertices tends to infinity, $N\rightarrow \infty$, the following relation takes place:
    $w_{n}={\begin{cases}{\frac {\langle k\rangle }{n-1}}u_{1}^{*n}(n-2),&n>1,\\p_{0}&n=1,\end{cases}}$
where $u_{1}(k):={\frac {k+1}{\langle k\rangle }}p_{k+1},$ and $u_{1}^{*n}$ denotes the $n$-fold convolution power. Moreover, explicit asymptotes for $w_{n}$ are known when $n\gg 1$ and $|\langle k^{2}\rangle -2\langle k\rangle |$ is close to zero. The analytical expressions for these asymptotes depend on finiteness of the moments of $p_{k},$ the degree distribution tail exponent $\beta$ (when $p_{k}$ features a heavy tail), and the sign of Molloy–Reed criterion. The following table summarises these relationships (the constants are provided in).
| Moments of $p_{k}$ | Tail of $p_{k}$ | ${\text{sign}}(\langle k^{2}\rangle -2\langle k\rangle )$ | $w_{n},\;n\gg 1,\;\alpha =\beta -2$ |
| $\langle k^{3}\rangle <\infty$ | light tail | -1 or 1 | $C_{1}e^{-C_{2}n}n^{-3/2}$ |
| $\langle k^{3}\rangle <\infty$ | light tail | 0 | $C_{1}n^{-3/2}$ |
| $\langle k^{3}\rangle <\infty$ | heavy tail, $\beta >4$ | -1 | $C_{3}n^{-\alpha -1}$ |
| $\langle k^{3}\rangle <\infty$ | heavy tail, $\beta >4$ | 0 | $C_{1}n^{-3/2}$ |
| $\langle k^{3}\rangle <\infty$ | heavy tail, $\beta >4$ | 1 | $C_{1}e^{-C_{2}n}n^{-3/2}$ |
| $\langle k^{3}\rangle =\infty ,$ $\langle k^{2}\rangle <\infty ,$ | heavy tail, $\beta =4$ | -1 | $C_{3}n^{-\alpha -1}$ |
| $\langle k^{3}\rangle =\infty ,$ $\langle k^{2}\rangle <\infty ,$ | heavy tail, $\beta =4$ | 0 | $C_{1}'{\frac {n^{-3/2}}{\sqrt {\log n}}}$ |
| $\langle k^{3}\rangle =\infty ,$ $\langle k^{2}\rangle <\infty ,$ | heavy tail, $\beta =4$ | 1 | $C_{1}'{\frac {n^{-3/2}}{\sqrt {\log n}}}e^{-C_{2}'{\frac {n}{\log n}}}$ |
| $\langle k^{3}\rangle =\infty ,$ $\langle k^{2}\rangle <\infty ,$ | heavy tail, $3<\beta <4$ | -1 | $C_{3}n^{-\alpha -1}$ |
| $\langle k^{3}\rangle =\infty ,$ $\langle k^{2}\rangle <\infty ,$ | heavy tail, $3<\beta <4$ | 0 | $C_{4}n^{-{\frac {1}{\alpha }}-1}$ |
| $\langle k^{3}\rangle =\infty ,$ $\langle k^{2}\rangle <\infty ,$ | heavy tail, $3<\beta <4$ | 1 | $C_{5}e^{-C_{6}n}n^{-3/2}$ |
| $\langle k^{2}\rangle =\infty ,$ $\langle k\rangle <\infty ,$ | heavy tail, $\beta =3$ | 1 | $C_{7}e^{-C_{8}-C_{9}n^{\frac {2}{\pi }}}n^{{\frac {1}{\pi }}-2}$ |
| $\langle k^{2}\rangle =\infty ,$ $\langle k\rangle <\infty ,$ | heavy tail, $2<\beta <3$ | 1 | $C_{10}e^{-C_{11}n}n^{-3/2}$ |

## Modelling
### Comparison to real-world networks

Three general properties of complex networks are heterogeneous degree distribution, short average path length and high clustering. Having the opportunity to define any arbitrary degree sequence, the first condition can be satisfied by design. Still, as shown above, the global clustering coefficient is an inverse function of the network size, so for large configuration networks, clustering tends to be small. This feature of the baseline model contradicts the known properties of empirical networks, but extensions of the model can solve this issue. (see). All the networks generated by this model are locally tree-like provided the average of the excess degree distribution is either constant or grows slower than the square root of number of links, ${\sqrt {m}}$. In other words, this model prevents forming substructures such as loops in the large size limit. Vanishing of clustering coefficient, is a special case of this more general result. While the tree-like property makes the model not very realistic, so many calculations, such as the generating function methods, are possible for the configuration model thanks to this feature.

## Directed configuration model

In the DCM (directed configuration model), each node is given a number of half-edges called tails and heads. Then tails and heads are matched uniformly at random to form directed edges. The size of the giant component, the typical distance, and the diameter of DCM have been studied mathematically. There also has been extensive research on random walks on DCM. Some real-world complex networks have been modelled by DCM, such as neural networks, finance and social networks.