- Introduced by
- Nowicki, K. & Snijders, T. A. B.; extended by Peixoto, T. P.
- Year
- 2001–2014
- Type
- Probabilistic generative model with Bayesian inference
- Family
- Network science
What does it do?
The Bayesian Stochastic Block Model (Bayesian SBM) is a probabilistic method for community detection in networks.
It treats each node's group as a latent variable and uses Bayesian inference to recover the block structure and to infer the number of blocks from the data, rather than optimising a fixed quality score. The approach builds on the latent-class blockmodel framework of Nowicki and Snijders (2001), and later work by Peixoto (2014) developed efficient inference for it.
The intuition behind the method
Think of a network as generated by a hidden process: each node belongs to a latent group, and edges form between nodes with a probability that depends only on which groups they belong to. The Bayesian SBM asks which assignment of nodes to groups makes the observed edges most probable, while penalising models that are more complex than the data justify. Because the number of groups is part of the inference, the method does not require it to be set in advance. Extra groups are kept only when the edge pattern supports them.
History
Nowicki and Snijders (2001) proposed a Bayesian approach to latent-class blockmodels for directed and valued graphs. They estimated the posterior with Gibbs sampling and addressed the non-identifiability of class labels by restricting inference to invariant functions of the parameters and class memberships. Peixoto (2014) developed an efficient MCMC method and a greedy agglomerative heuristic for inferring stochastic block models, and implementations are available in graph-tool.
When to use it
Choose Bayesian SBM when you want community detection in which the number of groups is inferred from the data, when you need a generative model whose candidate partitions can be compared on a common statistical basis, or when uncertainty about individual node assignments matters for your question. It is designed for adjacency data, either binary or weighted graphs. For a very large or very dense graph, MCMC runtime may be prohibitive. The greedy heuristic from the 2014 work is a much faster alternative, but it yields a point partition with no posterior uncertainty for node assignments. If you need marginal membership probabilities, you need posterior sampling despite its cost. Also avoid the method when the number of groups is fixed by design and does not need to be inferred. If the degree distribution is strongly heterogeneous, consider a degree-corrected variant rather than the standard one.
Limitations and considerations
- MCMC sampling is computationally expensive for very large or very dense networks; the greedy heuristic from the 2014 work is much cheaper but gives no posterior uncertainty.
- Results can be sensitive to the prior on the number of blocks, and a different prior may change the number of blocks selected.
- Block labels are exchangeable, so comparing partitions across independent runs requires matching labels, a non-identifiability problem that the 2001 work also addresses.
- The model assumes that edge probabilities depend only on block membership, so high-degree nodes can be absorbed into block structure unless a degree-corrected variant is used.
- As a generative model, it is only as good as its fit to the data: the chosen SBM variant should be plausible for the network.
- The 2014 work reports that the greedy heuristic matched MCMC on the networks it studied; this does not guarantee equivalence on other networks.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- The number of blocks is chosen by model comparison rather than by maximising a quality score such as modularity, so it is an output of inference rather than a tuning choice.
- Sampling yields a posterior over partitions, so each node's membership comes with marginal probabilities rather than only a single label.
- The 2014 work states that its method is entirely unbiased towards any specific mixing pattern and does not favour assortative community structure.
- The 2001 framework handles the arbitrariness of class labels explicitly by restricting inference to invariant functions of the parameters and class memberships, so reported summaries do not depend on label names.
Applications
- Community detection in social, biological, and information networks, with the number of groups inferred from the data.
- Identifying functional modules in protein-protein interaction networks.
- Detecting groups in citation and co-authorship networks, such as political or ideological blocs, where the tie data support them.
- Hierarchical decomposition of large networks into nested community structure using the hierarchical variant.
- Benchmarking and null-model comparison of other community detection algorithms.
How it works
How it works
A prior is placed on the number of blocks k and on the block-assignment vector b. The mechanics step shows P(k) ∝ 1/k as one illustrative choice of prior on k. The form of this prior is a modelling decision, not something fixed by the method, and the number of blocks selected can depend on it.
Formula
P(k) \propto 1/k \text{ (one illustrative prior on the number of blocks)}Given the assignment b and the block-pair edge probabilities omega, the likelihood of the adjacency matrix A is a product over block pairs of binomial terms. Each term compares the observed number of edges between a pair of blocks with the number of possible edges. This measures how well the current partition explains the observed pattern of ties within and between groups.
Formula
P(A|b,\omega) = \prod_{rs} \binom{e_{rs}^{\max}}{e_{rs}} \omega_{rs}^{e_{rs}}(1-\omega_{rs})^{e_{rs}^{\max}-e_{rs}}Inference explores partitions from the posterior P(b | A) using Markov chain Monte Carlo, which proposes moving individual nodes between blocks and accepts or rejects each move under the Metropolis-Hastings rule. The 2014 work also describes a greedy agglomerative heuristic with almost linear O(N ln² N) complexity. It reports results indistinguishable from the MCMC method on many of the artificial and empirical networks studied there, while being much faster. This does not guarantee equivalence on other networks. The heuristic returns a single partition rather than posterior samples.
The number of blocks is chosen with a minimum description-length criterion. The preferred model is the one that minimises a total score combining the cost of describing the data given the partition with the cost of describing the model itself, so extra blocks are retained only when they compress the adjacency matrix enough to offset their added complexity. The exact form of the complexity term depends on the model variant and prior used, and is defined in Peixoto (2014).
Formula
\Sigma = -\ln P(A,b) \text{ (description length; complexity term defined in Peixoto 2014)}Node labels are read from a point estimate, such as the maximum a posteriori partition, or summarised across posterior samples. Marginal posterior probabilities give the strength of each node's assignment to its block. Nodes whose probability is spread across several blocks sit near community boundaries and should be interpreted cautiously.
Common pitfalls
- Accepting a partition after too few MCMC sweeps, before the description length or log-posterior has stabilised.
- Fitting the standard variant to a network with a heavy-tailed degree distribution, where high-degree hubs may be grouped into their own blocks; the degree-corrected variant is designed for this case.
- Treating the maximum a posteriori partition as certain without inspecting marginal posterior probabilities for nodes near block boundaries.
- Comparing the number of communities found here with the number found by modularity maximisation, as though both measure the same thing.
- Reporting a block count from a small network without checking the posterior spread, since little information about block structure may be present in the data.
Frequently asked questions
How does Bayesian SBM differ from modularity maximisation?
Modularity maximisation optimises a heuristic quality score and has a resolution limit, which restricts the scale of communities it can detect relative to the network's total edge count. Bayesian SBM is a generative model whose candidate partitions are compared through Bayesian evidence or description length, so the number of blocks is an output of inference rather than a tuning choice.
Do I need to specify the number of communities in advance?
No. Bayesian SBM infers the number of blocks from the data. The prior and the likelihood jointly determine how many blocks the observed edge pattern supports, so k does not need to be set beforehand.
What software implements Bayesian SBM?
graph-tool, a Python library with a C++ core and implemented by Peixoto, provides standard, degree-corrected, weighted, and hierarchical variants of the stochastic block model.
When should I use the degree-corrected variant?
Use the degree-corrected SBM when your network has a heterogeneous degree distribution, with a few very high-degree hubs and many low-degree nodes. The standard SBM can place high-degree nodes into separate spurious blocks; the degree-corrected version separates degree effects from community structure.
How do I assess convergence of the MCMC sampler?
Monitor the description length or log-posterior as a function of MCMC sweeps. Convergence is indicated by a stable plateau. Running several independent chains from different random starting partitions and checking that they reach similar description lengths gives additional evidence of convergence.
Related methods
Sources
Peixoto, T. P. (2014). Efficient Monte Carlo and greedy heuristic for the inference of stochastic block models. Physical Review E, 89(1), 012804.
Open DOI referenceNowicki, K., & Snijders, T. A. B. (2001). Estimation and prediction for stochastic blockstructures. Journal of the American Statistical Association, 96(455), 1077–1087.
Open DOI reference