Algorithm Search⌘K

Proofs: DSATUR

These are the human proofs of DSATUR, at full length.

DSATUR returns a proper coloring and two-colors every bipartite graph full

This proof shows: correctness, termination.

Let G=(V,E)G = (V, E) be a simple undirected graph with nn vertices. Call round tt the tt-th run of the loop of line L2, and let UtU_t be the set of uncolored vertices at its start, so U1=VU_1 = V.

Claim. DSATUR(G)(G) stops after nn rounds and returns cc with c(v)≥1c(v) \ge 1 for all vv and c(u)≠c(v)c(u) \ne c(v) for each edge {u,v}\{u, v\}. The color of vv is at most ∣S[v]∣+1≤deg⁡(v)+1|S[v]| + 1 \le \deg(v) + 1 at the moment it is colored. If GG is bipartite, c(v)∈{1,2}c(v) \in \{1, 2\} for all vv.

Invariant. At the start of round tt:

(D) c(v)=0c(v) = 0 exactly for v∈Utv \in U_t, and ∣Ut∣=n−t+1|U_t| = n - t + 1. For each v∈Utv \in U_t, S[v]={c(w):w∈N(v)∖Ut}S[v] = \{ c(w) : w \in N(v) \setminus U_t \} and dunc[v]=∣N(v)∩Ut∣\mathrm{dunc}[v] = |N(v) \cap U_t|. No edge joins two colored vertices of the same color.

Initialization. Line L1 sets every color to 0, every S[v]S[v] to ∅\emptyset and dunc[v]\mathrm{dunc}[v] to deg⁡(v)\deg(v), which is (D) for U1=VU_1 = V.

Maintenance. In round t≤nt \le n, UtU_t is not empty, so line L3 finds a vertex v∈Utv \in U_t. The set S[v]S[v] has at most ∣S[v]∣|S[v]| elements, so one of 1,…,∣S[v]∣+11, \ldots, |S[v]| + 1 is not in it, and line L4 stops with 1≤k≤∣S[v]∣+11 \le k \le |S[v]| + 1 and k∉S[v]k \notin S[v]. By (D), kk differs from the color of every colored neighbor of vv, so after line L5 no edge joins two colored vertices of the same color. Now Ut+1=Ut∖{v}U_{t+1} = U_t \setminus \{v\}. For w∈Ut+1w \in U_{t+1}, the set N(w)∖Ut+1N(w) \setminus U_{t+1} gains vv exactly when ww is a neighbor of vv; lines L6 to L8 add c(v)=kc(v) = k to S[w]S[w] and lower dunc[w]\mathrm{dunc}[w] by one for exactly these ww, once each since GG is simple. So (D) holds at the start of round t+1t + 1. Also ∣S[v]∣≤∣N(v)∣=deg⁡(v)|S[v]| \le |N(v)| = \deg(v).

Termination. Each round colors one vertex of UtU_t, and line L4 stops after at most deg⁡(v)+1\deg(v) + 1 tests. After nn rounds, (D) with Un+1=∅U_{n+1} = \emptyset says that all vertices are colored with colors at least 1 and the coloring is proper.

Bipartite graphs. Let GG be bipartite with a bipartition fixed in each connected component. We show by induction on tt that at the start of round tt:

(B) at most one connected component CC is partly colored (it has colored and uncolored vertices); in that component the colored vertices induce a connected subgraph; and every colored vertex has color 1 or 2, with the colors given by the sides of its component (in each component, all colored vertices of one side share one color, and the other side has the other color).

For t=1t = 1 nothing is colored. Assume (B) at round tt and let vv be the vertex chosen at line L3.

Case 1: some component CC is partly colored. Since CC is connected and has colored and uncolored vertices, some uncolored u∈Cu \in C has a colored neighbor, so ∣S[u]∣≥1|S[u]| \ge 1. A vertex in any other component has no colored neighbor, because the other components are fully colored or fully uncolored; so its saturation is 0. Line L3 compares saturation first, so v∈Cv \in C and ∣S[v]∣≥1|S[v]| \ge 1. All colored neighbors of vv lie on the side of CC opposite to vv, so by (B) they all have one color x∈{1,2}x \in \{1, 2\}, and S[v]={x}S[v] = \{x\}. Line L4 gives vv the color 3−x3 - x. If other colored vertices of CC lie on the side of vv, then by (B) they have the color other than xx, which is 3−x3 - x; so the colors in CC still follow the sides. The colored part of CC stays connected, because vv has a colored neighbor. So (B) holds after round tt, with CC partly colored or now fully colored.

Case 2: no component is partly colored. Then every uncolored vertex has saturation 0, and vv starts a new component C′C' with S[v]=∅S[v] = \emptyset, so c(v)=1c(v) = 1. The colored part of C′C' is {v}\{v\}, which is connected and uses the color 1 on the side of vv. If C′={v}C' = \{v\}, then C′C' is fully colored. So (B) holds after round tt.

In both cases each new color is 1 or 2. So DSATUR colors every bipartite graph with at most 2 colors. ■\blacksquare

Back to DSATUR