Proofs: Label propagation algorithm
These are the human proofs of Label propagation algorithm, at full length.
Label propagation stops after at most m + 1 rounds with a stable labelling full
This proof shows: correctness, termination.
Let be an undirected simple graph with vertices and edges, and let be the set of neighbours of . For a labelling , a vertex and a label , let . A labelling is stable when for every with .
Let , the number of agreeing edges. Clearly .
Lemma 1 (each change raises the potential). If line L7 changes the label of from to , then grows by , where is the labelling just before the change.
Proof. Only the edges at can change status. Before the change, the edge agrees exactly when , which holds for edges; after it, exactly when , which holds for edges, since the labels of the neighbours do not change and . Line L6 ran just before with the counts of line L5, which are , and found ; line L7 chose with . Both counts are integers, so the difference is at least 1.
Lemma 2 (termination). The loop of lines L2 to L9 runs at most times.
Proof. At the start, every label is distinct, so . By Lemma 1 and , line L7 changes a label at most times in the whole run. A round that sets to true makes at least one change, so at most rounds do so. The first round that makes no change ends the loop at line L9, and it is at most round .
Lemma 3 (stability at exit). When the loop ends, the labelling is stable.
Proof. The loop ends after a round in which line L8 never ran, so no label changed during that round, and every vertex was visited once with the final labelling . For each with a neighbour, the test of line L6 failed, so , where the maximum is over the labels of the neighbours and is at least 1. Then , so is one of those labels, and the reverse inequality holds too. So .
Lemma 4 (communities stay inside components). At all times, every label that some vertex holds is a vertex of the same connected component as that vertex.
Proof. At the start, . Line L7 gives a label held by a neighbour of , which by induction lies in the component of that neighbour, the component of .
Theorem. LABEL-PROPAGATION() stops after at most rounds, for every random order and every random choice, and returns the classes of a stable labelling; each class lies inside one connected component of .
Proof. Lemma 2 gives termination, Lemma 3 stability, and Lemma 4 that two vertices with equal labels lie in the same component as that label, hence in one component.
∎