Algorithm Search⌘K

Proofs: k-dimensional Weisfeiler-Leman algorithm

These are the human proofs of k-dimensional Weisfeiler-Leman algorithm, at full length.

k-WL terminates, and a difference in its colors proves non-isomorphism full

This proof shows: correctness, termination.

Setting. GG is a simple undirected graph on V={0,…,n−1}V = \{0, \ldots, n-1\} with a vertex coloring, and k≥2k \ge 2. For a kk-tuple tt and w∈Vw \in V, t[i/w]t[i/w] is tt with entry ii replaced by ww. The colorings χ0,χ1,…\chi_0, \chi_1, \ldots of VkV^k are: χ0(t)\chi_0(t) is the atomic type of tt, and χr+1(t)\chi_{r+1}(t) is the rank, in the sorted list of all signatures, of

σr(t)=(χr(t), { ⁣{(χr(t[1/w]),…,χr(t[k/w])):w∈V} ⁣}).\sigma_r(t) = \Big(\chi_r(t),\ \{\!\{ (\chi_r(t[1/w]), \ldots, \chi_r(t[k/w])) : w \in V \}\!\}\Big).

When two graphs are compared, the ranks are taken in the sorted list of the signatures of both graphs together.

Lemma 1 (refinement). For every rr, χr+1(t)=χr+1(u)\chi_{r+1}(t) = \chi_{r+1}(u) implies χr(t)=χr(u)\chi_r(t) = \chi_r(u).

Proof. Equal ranks mean equal signatures, and the signature starts with χr\chi_r. □\square

Lemma 2 (stability). If χr+1\chi_{r+1} has as many classes as χr\chi_r, then χr+1\chi_{r+1} and χr\chi_r induce the same partition of VkV^k, and so do all later colorings.

Proof. By Lemma 1 every class of χr+1\chi_{r+1} lies inside a class of χr\chi_r. With the same number of classes, each class of χr\chi_r is exactly one class of χr+1\chi_{r+1}, so the partitions are equal. Then σr+1(t)=σr+1(u)\sigma_{r+1}(t) = \sigma_{r+1}(u) iff σr(t)=σr(u)\sigma_r(t) = \sigma_r(u), because σr+1\sigma_{r+1} is σr\sigma_r with every color renamed by the same bijection; hence χr+2\chi_{r+2} induces the same partition again, and by induction all later ones. □\square

Lemma 3 (termination). The loop L2 to L5 ends after at most nkn^k rounds.

Proof. By Lemmas 1 and 2, every round that does not stop strictly increases the number of classes, which is at most ∣Vk∣=nk|V^k| = n^k. □\square

Lemma 4 (invariance). Let γ:V(G)→V(H)\gamma : V(G) \to V(H) be an isomorphism of colored graphs, and run the joint refinement. Then χrH(γ(t))=χrG(t)\chi^H_r(\gamma(t)) = \chi^G_r(t) for all rr and all tt, where γ(t)\gamma(t) applies γ\gamma entrywise.

Proof. By induction on rr. For r=0r = 0, an isomorphism keeps colors, equalities and edges, so atomic types agree. For the step, γ(t)[i/γ(w)]=γ(t[i/w])\gamma(t)[i/\gamma(w)] = \gamma(t[i/w]), and w↦γ(w)w \mapsto \gamma(w) is a bijection of V(G)V(G) onto V(H)V(H), so the multisets in σr(t)\sigma_r(t) and σr(γ(t))\sigma_r(\gamma(t)) are equal by the induction hypothesis, as are the first entries. The two signatures are equal, so they get the same rank in the shared sorted list. □\square

Theorem. kwl_colors terminates and returns a stable coloring that refines the atomic types. kwl_distinguishes terminates, and if it returns true, the graphs are not isomorphic.

Proof. Termination of both functions is Lemma 3, applied to the joint coloring of the disjoint pair of tuple sets: the joint number of classes is at most 2nk2 n^k and grows strictly in every round that does not stop. On stopping, Lemma 2 says the coloring is stable. If G≅HG \cong H by γ\gamma, Lemma 4 shows that t↦γ(t)t \mapsto \gamma(t) is a bijection of V(G)kV(G)^k onto V(H)kV(H)^k that keeps colors in every round, so the color histograms are equal in every round and the function never returns true. Also, once the joint partition is stable, the histograms do not change any more up to the same renaming of colors, so comparing them at the stopping round is enough. ■\blacksquare

Back to k-dimensional Weisfeiler-Leman algorithm