TL;DR
A stochastic block model is a random network with hidden groups. Each vertex belongs to one group, and each pair of vertices is joined with a probability that depends only on the two groups involved, with pairs decided independently. Running the model produces a network with visible communities, and the model can also be run backwards: given a network, one can ask which grouping best explains it.
Builds on: Erdős–Rényi Random Graph, Latent Variable Model · Leads to: Community Detection
Where it's used
Finding communities in social networks. Sociologists and network scientists look at who talks to whom in a school, an office or an online forum. The block model asks for a grouping of people such that edges are dense inside groups and sparse between them. Karrer and Newman extended the model in 2011 so that each vertex can also have its own number of connections, which fits real networks much better.
Biological networks. Protein interaction maps and gene regulatory networks contain modules, sets of molecules that interact heavily with one another. A block model gives a principled way to propose such modules and to score how well a proposed set of modules explains the observed interactions.
Benchmarks for algorithms. A community-detection method needs test inputs where the true groups are known. Because the model generates a network from known groups, it provides such inputs with a controllable difficulty: when the inside probability is much larger than the outside one, the groups are easy to see; when the two are close, they are hard.
How it works
Take a small network with two groups. Vertices 1 and 2 are in group A, and vertex 3 is in group B. The probability table is
so two vertices in the same group join with probability if both are in A and if both are in B, and vertices in different groups join with probability .
- Assign each vertex a group. Vertices 1 and 2 get group A, vertex 3 gets group B. These labels are hidden from anyone who only sees the network. Check: each vertex has exactly one group.
- Look up the probability for each pair. Pair 1–2 has both vertices in A, so its probability is . Pair 1–3 and pair 2–3 each mix A and B, so their probability is . Check: the table is symmetric, so .
- Flip for each pair, independently. The pair 1–2 is joined with probability , and each of the other two pairs with probability . The coins do not affect one another. Check: three pairs, three independent decisions.
- Compute the probability of one outcome. Suppose the only edge drawn is 1–2. Then pair 1–2 is present and the other two are absent, which has probability . Check: the factor for an absent pair is one minus its probability.
- Run the model backwards in principle. Given only the edges, the group labels are unknown. Finding the labels that best explain the network is the inference problem the rest of this lesson is about. Check: step 4 used the labels; step 5 must recover them.
The generating process is a flow:
flowchart LR A["n vertices"] --> B["assign each vertex a hidden group"] B --> C["for each pair, look up probability in the group table"] C --> D["flip a coin for the pair"] D --> E["network with visible communities"]
The math
Let be the number of vertices and the number of groups. Let be group proportions summing to , and let be a symmetric matrix with entries in . Draw a label for each vertex , independently with . Then, given the labels, each pair is joined independently with probability . The adjacency entries are .
Step 1 in symbols: the labels
Each vertex draws a label from the categorical distribution with probabilities . If is the number of vertices with label , then is a random variable, with mean . In the walkthrough the labels are fixed, and , so the observed group proportions are for A and for B.
Step 2 in symbols: the edges
Given the labels, each entry of the adjacency matrix is independent:
Read the subscript as "the entry of in the row of vertex 's group and the column of vertex 's group". This is the walkthrough's table lookup.
Step 3 in symbols: the expected network
Let be the membership matrix, with if and otherwise. Then the matrix of edge probabilities is
Its entry is , which is exactly the table lookup of step 2. The diagonal entries are the probabilities of self-pairs; they are excluded from the network, so the expected degree must subtract them.
Step 4 in symbols: the likelihood of a network
For a network with adjacency entries , given labels ,
The labels are hidden, so the probability of the network alone sums this over all labelings: . This sum has terms, which is why exact computation is hard for large . This is where the expectation-maximization algorithm and maximum likelihood come in.
Step 5 in symbols: when can the groups be found?
Consider two groups of equal size and sparse edges, with and , so that a typical vertex has about neighbours. A famous condition from statistical physics, conjectured by Decelle, Krzakala, Moore and Zdeborová in 2011 and proved by later work of Mossel, Neeman and Sly and of Massoulié, is
Above this threshold, a grouping better than chance can be found from the network; below it, no method can do so as grows.
Worked examples
- Use the table from the walkthrough: , , and vertices 1 and 2 in A, vertex 3 in B.
- Pairs: 1–2 is A–A with probability ; 1–3 and 2–3 are A–B with probability .
- Outcome: the only edge is 1–2. Probability: .
- Arithmetic: , then .
Answer: .
- Groups: vertices 1 and 2 in group X, vertices 3 and 4 in group Y, so .
- Probability table: .
- Expected degree of vertex 1. It can join the 3 other vertices. Vertex 2 is in its own group, probability . Vertices 3 and 4 are in the other group, probability each.
- Sum: .
- Check with the formula for : . The subtraction removes the self-pair that the sum counted.
- Expected number of edges: each of 4 vertices has expected degree , so the expected number of edges is .
Answer: each vertex has expected degree , and the network has expected edges.
Suppose a school has students in two equal classes, and the probability of a friendship is within a class and across classes. Are the classes detectable from the friendship network alone?
- Compute .
- Compute .
- Evaluate the left side: .
- Evaluate the right side: .
- Compare: , so the condition fails.
Answer: the classes are below the threshold, so no method can find them better than chance as the school grows.
Try it: a network of people in two equal groups has and . Is the grouping detectable?
Answer: and . Then and . Since , the groups are detectable.
Common mistakes and tradeoffs
It is tempting to think a block model's groups are visible in the network. In fact the groups are hidden labels, and a network drawn from the model can look random if the inside and outside probabilities are close. The model describes a distribution over networks, not a picture of one.
It is tempting to think a block model always produces dense groups. In fact the probability table decides the structure: a group can be dense inside and sparse to the rest, or sparse inside and dense to another group. Both are valid block structures, and "community" in the usual sense is only one of them.
It is tempting to think a block model fitted to a network is the true generating process. In fact real networks rarely match the model exactly, and a better fit does not prove the groups are real. Model checking, such as comparing simulated networks against the observed one, is needed.
Use the block model when you want an explicit, testable account of groups and when you can tolerate its assumption that the groups explain the edges independently. Do not use it when the network has strong degree differences that the plain model cannot capture, unless you use a degree-corrected variant. Alternatives include modularity maximisation, which optimises a score without a generative model, and spectral methods based on the adjacency matrix.
History
The block model was introduced by Holland, Laskey and Leinhardt in 1983 as a way to describe the roles people play in social networks. Earlier work on random graphs with structure, such as planted bisection problems in computer science in the 1980s, asked similar questions about recovering a hidden split.
In the 2000s, the planted partition formulation, a block model with one probability inside groups and another across, became a standard benchmark for computer scientists. Statistical physicists studying the same model found the threshold in step 5 by analysing belief propagation, which is why the condition has the form it has. Proofs that the threshold is sharp came from mathematicians in the following decade.
The model caught on because it is simple to simulate and gives a precise question: can the hidden groups be recovered? That question connects network science, statistics and statistical physics.
Recap
- A block model gives each vertex a hidden group, and each pair of vertices is joined independently with a probability read from a table indexed by the two groups.
- Given the labels, the expected adjacency matrix is , which makes the model a low-rank structure.
- The labels are unknown, so inference sums over all labelings or approximates the sum, which is where expectation-maximization enters.
- For two equal sparse groups, the sharp detectability threshold is .
- Read next: Community Detection for the methods that find groups in a network, which the block model justifies and tests.
Check yourself
QuestionIn the block model, what is the probability that two vertices in the same group are joined, given the labels?Show answer
It is the diagonal entry of the table for that group, because the probability depends only on the two groups, and both vertices are in the same group.
QuestionTwo vertices are in groups X and Y, and . What is the probability that the pair is joined, and what is the probability that it is not?Show answer
The pair is joined with probability and not joined with probability .
QuestionWhy is the sum over labelings hard to compute for a large network, and why does that matter for fitting the model?Show answer
Each vertex can take any of labels, so there are labelings, and the sum over them has that many terms. For large this is too many to enumerate, so fitting the model must use approximate methods such as expectation-maximization or Markov chain Monte Carlo.
QuestionA network has vertices in two equal groups with and . Is the grouping detectable by the threshold in step 5?Show answer
Yes. Here and , so and . Since , the groups are above the threshold, and a grouping better than chance can be found.