The k-Dimensional Weisfeiler-Leman Algorithm

Neil Immerman, Rik SenguptaarXiv 2019

Abstract: In this note, we provide details of the $k$-dimensional Weisfeiler-Leman Algorithm and its analysis from Immerman-Lander (1990). In particular, we present an optimized version of the algorithm that runs in time $O(n^{k+1}\log n)$, where $k$ is fixed (not varying with $n$).

The Graph Isomorphism Problem and k-WL

The Graph Isomorphism Problem—determining if two graphs are structurally identical—is one of the most famous challenges in computer science. While a general polynomial-time solution for all graphs remains elusive, the Weisfeiler-Leman (WL) algorithm provides a powerful hierarchy of heuristics.

An example of a graph with initial vertex coloring.

The $k$-WL algorithm works by coloring $k$-tuples of vertices and iteratively refining those colors based on the colors of their "neighbors." If two graphs result in different sets of colors, they are definitely not isomorphic. Beyond its utility as a test, $k$-WL is deeply linked to logic: it distinguishes two graphs if and only if they can be distinguished by first-order logic with counting quantifiers and $k+1$ variables ($C^{k+1}$).

Optimized Algorithmic Implementation

While the theoretical properties of $k$-WL are well-documented, detailed and optimized algorithmic descriptions are often sparse. This paper fills that gap by providing a clear, efficient implementation and a formal runtime analysis.

Algorithm 2: The optimized k-dimensional Weisfeiler-Leman Algorithm.

The optimized version of the algorithm relies on several key techniques:

  1. Iterative Color Refinement: The algorithm starts with an initial coloring based on the local structure (isomorphism type) of $k$-tuples. In each round, it updates the color of a tuple based on the colors of its "j-neighbors."
  2. The Work List ($L$): Instead of re-scanning every tuple in every round, the algorithm maintains a "work list" of color classes that were recently modified. Updates are only triggered by these changed classes.
  3. The "Smallest-Half" Optimization: When a color class splits into multiple new classes, the algorithm only adds the smaller resulting pieces to the work list. The largest piece retains the old color and doesn't trigger immediate updates. This classic trick (similar to Hopcroft’s DFA minimization) is what keeps the complexity bound tight.
  4. Efficient Sorting: The algorithm uses Radix Sort to group tuples and identify new color classes in linear time relative to the number of processed elements.

Key Insights and Results

  • The Logic Link: The paper reinforces that $k$-WL is exactly equivalent to the expressive power of counting logic with $k+1$ variables. The algorithm is a physical implementation of a logical boundary.
  • Logarithmic Efficiency: The most significant insight is how the work list and the "smallest-half" rule interact. Because a tuple's color class only enters the work list when it is part of a split that is at most half the size of its parent class, any specific tuple can trigger an update at most $O(\log(n^k))$ times.
  • Complexity Bounds: For any fixed $k \ge 2$, the optimized $k$-dimensional WL algorithm runs in $O(k^2 n^{k+1} \log n)$ time. The standard 1-dimensional color refinement algorithm runs in $O(n^2 \log n)$ time.

Limitations and Future Work

The authors focus strictly on the algorithmic implementation and the $O(n^{k+1} \log n)$ bound. They do not address lower bounds for specific graph families where $k$-WL fails, such as the Cai-Fürer-Immerman graphs. Furthermore, while the big-O complexity is efficient, the $n^{k+1}$ factor and hidden constants make the algorithm computationally expensive for large $n$ and $k > 3$. Exploring how this optimized work-list approach translates to parallel or distributed environments remains a potential area for future research.

Summary updated

BibTeX
@misc{immerman2019k,
  author = {Neil Immerman and Rik Sengupta},
  title = {{The k-Dimensional Weisfeiler-Leman Algorithm}},
  year = {2019},
  eprint = {1907.09582},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1907.09582},
}
Figure