A combinatorial optimization problem asks for a configuration , each in a finite alphabet, that minimizes a cost built from local terms — clauses, edges, constraints. Graph colouring, maximum independent set, matching, and satisfiability are all of this form.

Statistical physics offers a single reframing. Attach to the cost the Boltzmann distribution

As the measure concentrates on the minimizers of , so sampling at large solves the optimization. At finite the same object interpolates to counting and inference. The free entropy governs both: its value counts low-cost configurations, and its derivatives give the energy and the entropy.

Note 1.1 (Two problems, one object).

The marginals tell us how to decide each variable (the maximum-a-posteriori estimate at large ), while counts solutions. Both are -hard in general. Belief propagation computes both exactly when the interaction graph is a tree, and approximately — often remarkably well — when it is only locally tree-like.

The rest of this module writes the Boltzmann weight as a factor graph, so that the tree recursion of Module 2 has something to recurse on.

Factor graphs

Every local cost factorizes its Boltzmann weight into a product of local non-negative functions. A factor graph makes that factorization explicit as a bipartite graph with two kinds of nodes.

Definition 1.1 (Factor graph).

A factor graph is a bipartite graph with

  • variable nodes (circles), each carrying a variable ,
  • factor nodes (squares), each carrying a non-negative function of the variables it touches.

Write for the variables attached to factor , and for the factors attached to variable . Separating single-variable fields from interaction factors , the joint law is

Edges exist only between a variable and a factor. The objects we want are the single-variable marginals and the free entropy,

Both are sums over configurations. On a tree factor graph they can be computed exactly in linear time; that computation is belief propagation, derived in Module 2.

g1 1 a 2 b 3 4
Figure 1.1. A generic factor graph. Circles are variables; squares are factors. The field g1 touches only s1; fa couples s1 and s2; fb is ternary.

Figure 1.1 is the running picture. The joint law is the normalized product of every factor on that graph.

Four running examples

We will return to these throughout. Each is a factor graph, so each inherits the same BP equations once those are derived.

Example 1.1 (Ising / pairwise spin glass).

Spins , fields , and an edge factor for each coupled pair.

1 a 2 b 3
Figure 1.2. Pairwise Ising as a factor graph: one binary factor per coupled pair.

Figure 1.2 is the pairwise case of Example 1.1.

Example 1.2 (Graph colouring).

Colours and one factor per edge, . The limit enforces a proper colouring. Because every factor has degree two, BP will later reduce to a recursion on the original graph.

1 2 3 a b c
Figure 1.3. q-colouring: one antiferromagnetic Potts factor per edge.

Figure 1.3 is the factor graph of Example 1.2. Because every factor has degree two, BP later reduces to a recursion on the original graph.

The factor c on the bottom edge sits on the line between 2 and 3, and its label c may overlap the line. The boxes of 2, c, 3 are at y=132/134 — labels will overlap (2, c, 3 at similar y). I need to move factor c below the edge.

Fix: put c at (140, 178) below the 2—3 edge, and connect with a short stub… actually for a factor graph the factor is ON the edge. Place c at midpoint (140, 150) but then 2 is at 70, 3 at 210, c at 140 - all y=150. The text “2”, “c”, “3” are horizontally separated by 70px so they should NOT overlap each other.

2 text at x=70, c at x=140, 3 at x=210. Each ~10px wide. No overlap.

But factor c box at (124, 134) w=32 vs var 2 box at (52, 132) w=36. They don’t overlap (52+36=88, c starts 124).

Var 1 at top. Factors a, b on the diagonals. Good.

There’s a potential issue: factor c box at y=134 height 32 ends at 166, vars 2 and 3 at y=132 height 36 end at 168. The c box is between 2 and 3 horizontally: 124-156 vs 52-88 and 192-228. Fine.

Example 1.3 (Independent set / hard-core).

Membership , fugacity , and a hard factor on each graph edge: neighbouring vertices cannot both be occupied.

Example 1.4 (Matching).

Dual to independent set: binary variables live on graph edges, hard factors live on graph vertices and enforce . A fugacity favours larger matchings.

The last two are drawn in Module 4, where we specialize BP to them. The point for now is only the translation: a combinatorial constraint is a factor; the factor graph is the data structure the algorithm will walk.

Sparse graphs are locally tree-like

The approximation we will make in Module 3 — reuse the tree recursion on a loopy graph — is not arbitrary. Consider a sparse random graph in which each edge is present with probability , so the mean degree stays finite as . Start a non-backtracking walk at a node and ask when it first returns.

After steps a node has about descendants. The probability that none of them coincides with the origin is , so the origin sits on a loop of length only once is comparable to :

Hence the neighbourhood of a typical variable, out to distance , is a tree with high probability — short loops are rare.

i 1 2 3 4 5 6 first loop ~ log N
Figure 1.4. On a sparse random graph the neighbourhood of i is a tree out to distance about log N / log c. Short loops are rare.

If correlations decay on an length scale, a variable effectively interacts with a tree, and the tree-exact BP equations become asymptotically exact for the marginals and for . When correlations do not decay fast enough — the replica-symmetry-broken regime of Module 4 — the tree picture fails and BP must be corrected.

Theorem 1.1 (The programme).

On a tree, pinning a variable disconnects the graph into independent branches. The next lecture turns that one fact into the belief-propagation update, without postulating any message-passing rule.

Next: Deriving belief propagation.