Algorithm Search⌘K

Theoremadvanced

Kolmogorov-Zabih representability theorem

Also called graph-representable energies, regularity condition for graph cuts.

Only regular (submodular) binary energies can be represented by a cut. With terms of at most three variables, regularity is also sufficient, so one min cut minimizes them exactly.

The Kolmogorov-Zabih theorem says which energies of binary variables a minimum cut can minimize exactly. An energy is graph-representable if there is a directed graph with nonnegative capacities, a source, a sink and one node for each variable, such that the energy of every assignment equals, up to a constant, the cheapest cut that puts the nodes of the variables with value 0 on the source side and the others on the sink side. Such an energy is minimized by one max-flow computation, by the max-flow min-cut theorem. The theorem says that a graph-representable energy must be regular: every restriction of it to two variables, with the other variables fixed, satisfies E(0,0)+E(1,1)≤E(0,1)+E(1,0)E(0,0) + E(1,1) \le E(0,1) + E(1,0). For energies that are sums of terms of at most two variables (the class F2\mathcal{F}^2) and at most three variables (F3\mathcal{F}^3), this condition is also sufficient. Regularity is the same as submodularity of the energy seen as a set function. The theorem is the base of the move algorithms alpha-expansion and alpha-beta swap, and QPBO is the method for energies that are not regular.

Statement

Let E:{0,1}n→RE : \{0,1\}^n \to \mathbb{R} be a function of binary variables x1,…,xnx_1, \ldots, x_n.

Graph-representable (Kolmogorov and Zabih, Definition 3.1). EE is graph-representable if there is a directed graph GG with nonnegative edge capacities, terminals ss and tt, nodes v1,…,vnv_1, \ldots, v_n and possibly more nodes, and a constant KK, such that for every x∈{0,1}nx \in \{0,1\}^n

E(x)=K+min⁡{ c(S):s∈S, t∉S, vi∈S if xi=0, vi∉S if xi=1 },E(x) = K + \min \{\, c(S) : s \in S,\ t \notin S,\ v_i \in S \text{ if } x_i = 0,\ v_i \notin S \text{ if } x_i = 1 \,\},

where c(S)c(S) is the total capacity of the edges from SS to the other nodes. The extra nodes may be on either side.

Projection and regularity. A projection of EE to two variables xi,xjx_i, x_j is the function F(a,b)F(a, b) of two binary variables that EE gives when xi=ax_i = a, xj=bx_j = b and all other variables have fixed values. EE is regular if every projection to two variables satisfies

F(0,0)+F(1,1)≤F(0,1)+F(1,0).F(0,0) + F(1,1) \le F(0,1) + F(1,0).

A function of one variable has no such condition. F2\mathcal{F}^2 is the class of functions E(x)=∑iEi(xi)+∑i<jEi,j(xi,xj)E(x) = \sum_i E^i(x_i) + \sum_{i<j} E^{i,j}(x_i, x_j) and F3\mathcal{F}^3 adds terms Ei,j,k(xi,xj,xk)E^{i,j,k}(x_i, x_j, x_k).

Theorem.

  1. (Necessity, Theorem 6.1 of the paper.) Every graph-representable function is regular.
  2. (Class F2\mathcal{F}^2, Theorem 4.1.) E∈F2E \in \mathcal{F}^2 is graph-representable if and only if every pairwise term satisfies Ei,j(0,0)+Ei,j(1,1)≤Ei,j(0,1)+Ei,j(1,0)E^{i,j}(0,0) + E^{i,j}(1,1) \le E^{i,j}(0,1) + E^{i,j}(1,0).
  3. (Class F3\mathcal{F}^3, Theorem 5.3.) E∈F3E \in \mathcal{F}^3 is graph-representable if and only if it is regular.

In parts 2 and 3 the graph has O(n+T)O(n + T) nodes and edges for TT terms, so a regular EE in F3\mathcal{F}^3 is minimized exactly in polynomial time by one max-flow computation: a minimum cut SS gives the minimizer xi=[vi∉S]x_i = [v_i \notin S].

In plain words

Think of each yes or no variable as a node that must go to one of two sides, the source side or the sink side. Cutting the graph into two sides costs the sum of the edges that cross from the source side to the sink side. If you can build a graph where this cost always equals your energy, then the cheapest cut tells you the best answer, and there are fast programs for the cheapest cut. The theorem says when such a graph exists. Look at any two variables. Agreeing in both ways must cost no more in total than disagreeing in both ways. If some pair breaks this rule, no graph can do it. If every pair keeps the rule and each term has at most three variables, a graph always exists.

Proof

Write c(S)c(S) for the capacity of the cut with source side SS.

Lemma (cuts are submodular). For any two node sets S1,S2S_1, S_2 that contain ss and not tt, c(S1)+c(S2)≥c(S1∩S2)+c(S1∪S2)c(S_1) + c(S_2) \ge c(S_1 \cap S_2) + c(S_1 \cup S_2).

Proof. Look at one edge (u,w)(u, w) of capacity γ≥0\gamma \ge 0. It counts in c(S)c(S) when u∈Su \in S and w∉Sw \notin S. Let ak=[u∈Sk]a_k = [u \in S_k] and bk=[w∉Sk]b_k = [w \notin S_k]. The edge adds γ(a1b1+a2b2)\gamma(a_1 b_1 + a_2 b_2) to the left side and γ(a1a2max⁡(b1,b2)+max⁡(a1,a2) b1b2)\gamma(a_1 a_2 \max(b_1, b_2) + \max(a_1, a_2)\, b_1 b_2) to the right side. If both right terms are 1, then a1=a2=b1=b2=1a_1 = a_2 = b_1 = b_2 = 1 and the left side is 2. If only the first is 1, then a1=a2=1a_1 = a_2 = 1 and some bk=1b_k = 1, so the left side is at least 1. If only the second is 1, then b1=b2=1b_1 = b_2 = 1 and some ak=1a_k = 1, so again the left side is at least 1. Sum over the edges. □\square

Part 1 (necessity). Let GG and KK represent EE. Fix a projection FF to xi,xjx_i, x_j, with the other variables at fixed values xˉ\bar x. Let S01S_{01} be a cheapest cut for the assignment with xi=0x_i = 0, xj=1x_j = 1 and xˉ\bar x, and let S10S_{10} be a cheapest cut for xi=1x_i = 1, xj=0x_j = 0 and xˉ\bar x. Then vi∈S01v_i \in S_{01}, vj∉S01v_j \notin S_{01}, vi∉S10v_i \notin S_{10} and vj∈S10v_j \in S_{10}. Every other variable node vkv_k is in both sets or in neither, because both use the values xˉ\bar x. So S01∩S10S_{01} \cap S_{10} is a cut for xi=xj=1x_i = x_j = 1 and xˉ\bar x, and S01∪S10S_{01} \cup S_{10} is a cut for xi=xj=0x_i = x_j = 0 and xˉ\bar x; both contain ss and not tt. By the definition and the lemma,

F(0,1)+F(1,0)−2K=c(S01)+c(S10)≥c(S01∩S10)+c(S01∪S10)≥F(1,1)−K+F(0,0)−K.F(0,1) + F(1,0) - 2K = c(S_{01}) + c(S_{10}) \ge c(S_{01} \cap S_{10}) + c(S_{01} \cup S_{10}) \ge F(1,1) - K + F(0,0) - K.

Part 2 (sufficiency for F2\mathcal{F}^2). Two facts make the construction modular. First, if E1E_1 and E2E_2 are represented by graphs on the same nodes s,t,v1,…,vns, t, v_1, \ldots, v_n, possibly with their own extra nodes, then E1+E2E_1 + E_2 is represented by the union of the two graphs, with capacities added on shared edges and constants added: the extra nodes of the two graphs are disjoint, so the minimum over their placement splits into two independent minimums. Second, each term is representable alone:

  • A unary term βxi\beta x_i with β≥0\beta \ge 0 is an edge s→vis \to v_i of capacity β\beta: it is cut exactly when vi∉Sv_i \notin S, that is xi=1x_i = 1. With β<0\beta < 0 write βxi=β+∣β∣(1−xi)\beta x_i = \beta + |\beta| (1 - x_i): an edge vi→tv_i \to t of capacity ∣β∣|\beta| and the constant β\beta. A general unary term is Ei(0)+(Ei(1)−Ei(0))xiE^i(0) + (E^i(1) - E^i(0)) x_i.
  • A pairwise term with A=Ei,j(0,0)A = E^{i,j}(0,0), B=Ei,j(0,1)B = E^{i,j}(0,1), C=Ei,j(1,0)C = E^{i,j}(1,0), D=Ei,j(1,1)D = E^{i,j}(1,1) equals
A+(C−A) xi+(D−C) xj+(B+C−A−D)(1−xi) xj,A + (C - A)\, x_i + (D - C)\, x_j + (B + C - A - D)(1 - x_i)\, x_j,

which the four cases check. The last product is 1 exactly when vi∈Sv_i \in S and vj∉Sv_j \notin S, so it is an edge vi→vjv_i \to v_j of capacity B+C−A−DB + C - A - D. The capacity is nonnegative exactly when the term is regular. The other parts are unary terms and a constant.

For the converse, the projection of E∈F2E \in \mathcal{F}^2 to xi,xjx_i, x_j is Ei,jE^{i,j} plus functions of one variable and a constant, which do not change F(0,0)+F(1,1)−F(0,1)−F(1,0)F(0,0) + F(1,1) - F(0,1) - F(1,0). So EE is regular exactly when every Ei,jE^{i,j} is regular, and Part 1 gives the "only if" direction.

Part 3 (sufficiency for F3\mathcal{F}^3). Write EE in its unique multilinear form

E(x)=a0+∑iaixi+∑i<jaijxixj+∑i<j<kaijkxixjxk.E(x) = a_0 + \sum_i a_i x_i + \sum_{i<j} a_{ij} x_i x_j + \sum_{i<j<k} a_{ijk} x_i x_j x_k.

For a projection to xi,xjx_i, x_j, the value F(0,0)+F(1,1)−F(0,1)−F(1,0)F(0,0) + F(1,1) - F(0,1) - F(1,0) is the coefficient of xixjx_i x_j after the other variables are fixed, which is aij+∑kaijkxka_{ij} + \sum_k a_{ijk} x_k. The other variables take all values, so EE is regular if and only if

aij+∑kmax⁡(aijk,0)≤0for every pair i<j.(R)a_{ij} + \sum_{k} \max(a_{ijk}, 0) \le 0 \quad \text{for every pair } i < j. \tag{R}

Replace each cubic monomial with one extra binary variable ww, using two identities that hold for all binary values (check the eight cases):

−P xixjxk=min⁡wP w (2−xi−xj−xk),P xixjxk=P (xixj+xixk+xjxk)+min⁡wP w (1−xi−xj−xk),-P\, x_i x_j x_k = \min_{w} P\, w\,(2 - x_i - x_j - x_k), \qquad P\, x_i x_j x_k = P\,(x_i x_j + x_i x_k + x_j x_k) + \min_{w} P\, w\,(1 - x_i - x_j - x_k),

with P≥0P \ge 0. In both, the products wxiw x_i have the coefficient −P≤0-P \le 0. A positive cubic monomial also adds aijka_{ijk} to the coefficient of each of its three pairs, and a negative one adds nothing. After all replacements, E(x)=min⁡wE′(x,w)E(x) = \min_w E'(x, w) where E′E' has only unary and pairwise terms, and the coefficient of xixjx_i x_j in E′E' is the left side of (R). A pairwise term γxixj\gamma x_i x_j has F(0,0)+F(1,1)−F(0,1)−F(1,0)=γF(0,0) + F(1,1) - F(0,1) - F(1,0) = \gamma, so every pairwise term of E′E' is regular. By Part 2, E′E' is represented by a graph with nodes for xx and ww. A minimum over cuts that fixes the nodes of xx is also a minimum over the placement of the nodes of ww, so the same graph, with the nodes of ww as extra nodes, represents EE. The converse is Part 1. □\square

The proof of Part 3 is a little different from the construction in Section 5.1 of the paper, which builds the graph for each regular term of three variables after a regrouping of the terms (Theorem 5.4 of the paper). Both give a graph of O(n+T)O(n + T) nodes and edges.

The minimizer. If GG represents EE and S∗S^* is a minimum cut, the assignment xi=[vi∉S∗]x_i = [v_i \notin S^*] has E(x)≤K+c(S∗)E(x) \le K + c(S^*), and every xx has E(x)≥K+c(S∗)E(x) \ge K + c(S^*), so xx is a minimizer.

Consequences

  • Binary labeling. Foreground and background segmentation and binary image restoration with an Ising or Potts prior have regular pairwise terms, so they are solved exactly by one cut. This is the case of Greig, Porteous and Seheult (1989) and of graph cut segmentation.
  • Move algorithms. A multi-label energy is minimized approximately by a sequence of binary moves. A move is one cut when its binary energy is regular. The swap move is regular when the pairwise term is a semimetric, and the expansion move when it is a metric. See alpha-beta swap and alpha-expansion.
  • Stereo with occlusions. The uniqueness constraint of graph cut stereo is an infinite pairwise term. It is regular only after the move variables are chosen with care, and the theorem tells which choices work.
  • Nonregular energies. For a pairwise energy that is not regular, QPBO builds a regular energy on twice as many variables and gets a partial optimal labeling.
  • A test before building a graph. To know whether a new energy can be minimized by one cut, check the inequality on every pairwise projection. If it fails anywhere, no graph exists, however many extra nodes it has.
  • Max-flow solvers. In vision the graphs are grids with a few edges per node, and the Boykov-Kolmogorov algorithm is the usual solver (an observed speed, not a bound).

A worked example

Take the pairwise term E(0,0)=0E(0,0) = 0, E(0,1)=3E(0,1) = 3, E(1,0)=2E(1,0) = 2, E(1,1)=1E(1,1) = 1. It is regular: 0+1≤3+20 + 1 \le 3 + 2. The formula of Part 2 gives E=2xi−xj+4(1−xi)xjE = 2 x_i - x_j + 4 (1 - x_i) x_j, and −xj=−1+(1−xj)-x_j = -1 + (1 - x_j). The graph has an edge s→vis \to v_i of capacity 2, an edge vj→tv_j \to t of capacity 1, an edge vi→vjv_i \to v_j of capacity 4, and K=−1K = -1.

(xi,xj)(x_i, x_j) source side cut edges cut cost $K + $ cost EE
(0,0)(0, 0) s,vi,vjs, v_i, v_j vj→tv_j \to t 1 0 0
(0,1)(0, 1) s,vis, v_i vi→vjv_i \to v_j 4 3 3
(1,0)(1, 0) s,vjs, v_j s→vis \to v_i, vj→tv_j \to t 3 2 2
(1,1)(1, 1) ss s→vis \to v_i 2 1 1

A non-example is the term that rewards disagreement, E(0,0)=E(1,1)=1E(0,0) = E(1,1) = 1 and E(0,1)=E(1,0)=0E(0,1) = E(1,0) = 0: here 1+1>0+01 + 1 > 0 + 0, so by Part 1 no graph represents it, with any number of extra nodes.

Tightness

  • Regularity is not enough for four variables. Živný, Cohen and Jeavons (2009) showed that some submodular functions of four binary variables cannot be written as the minimum over extra variables of a sum of submodular functions of two variables. So the "if" direction of Part 3 does not extend to all orders. Submodular functions of any order are still minimized in polynomial time by general submodular minimization, but not by one cut of this kind.
  • Nonregular terms make the problem hard. Theorem 4.2 of the paper shows that minimizing E∈F2E \in \mathcal{F}^2 is NP-hard when one fixed nonregular pairwise term may be placed on any pairs, together with arbitrary unary terms. So, unless P = NP, the limit that regularity puts on cuts is also a limit for every polynomial method on such classes.
  • Representation is not the only route. A single nonregular term of two variables is easy to minimize by trying the four cases. The theorem is about the cut construction, not about every polynomial method.

History

Greig, Porteous and Seheult (1989) showed that the maximum a posteriori estimate of a binary image with an Ising prior is a minimum cut, and so can be computed exactly. Quadratic pseudo-Boolean functions with nonpositive quadratic coefficients were known to be minimized by network flows in operations research before that; the survey of Boros and Hammer (2002) collects these results. Boykov, Veksler and Zabih (2001) used cuts for the moves of multi-label energies and built a graph for each kind of move. Kolmogorov and Zabih (2004) gave the general answer: they defined graph-representable functions, proved that regularity is necessary, and gave constructions for F2\mathcal{F}^2 and F3\mathcal{F}^3. Živný, Cohen and Jeavons (2009) showed that the construction cannot cover all submodular functions of four variables.

References

  1. Vladimir Kolmogorov and Ramin Zabih, What energy functions can be minimized via graph cuts?, IEEE Transactions on Pattern Analysis and Machine Intelligence 26(2), 2004, 147-159, Definition 3.1 (graph-representable functions), Theorem 4.1 (the class F2), Section 4.1 (the construction for F2), Theorem 4.2 (NP-hardness of nonregular F2), Theorem 5.3 and Section 5.1 (the class F3), Theorem 6.1 (regularity is necessary)
  2. D. M. Greig, B. T. Porteous and A. H. Seheult, Exact maximum a posteriori estimation for binary images, Journal of the Royal Statistical Society Series B 51(2), 1989, 271-279, the reduction of the MAP estimate of a binary image with an Ising prior to a minimum cut
  3. Stanislav Živný, David A. Cohen and Peter G. Jeavons, The expressive power of binary submodular functions, Discrete Applied Mathematics 157(15), 2009, 3347-3358, the result that some submodular functions of four variables cannot be expressed by binary submodular functions with extra variables
  4. Endre Boros and Peter L. Hammer, Pseudo-Boolean optimization, Discrete Applied Mathematics 123(1-3), 2002, 155-225, the parts on quadratic pseudo-Boolean functions, the multilinear form and the network flow methods for the submodular case
  5. Richard Szeliski, Computer Vision, Algorithms and Applications, second edition, Springer, 2022, Chapter 4, Model fitting and optimization (Markov random fields and their minimization by graph cuts)

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/HPRR7C/text.yaml