# On the Weisfeiler-Leman Dimension of Finite Groups

In comparison to graphs, combinatorial methods for the isomorphism problem of finite groups are less developed than algebraic ones. To be able to investigate the descriptive complexity of finite groups and the group isomorphism problem, we define the Weisfeiler-Leman algorithm for groups. In fact we define three versions of the algorithm. In contrast to graphs, where the three analogous versions readily agree, for groups the situation is more intricate. For groups, we show that their expressive power is linearly related. We also give descriptions in terms of counting logics and bijective pebble games for each of the versions. In order to construct examples of groups, we devise an isomorphism and non-isomorphism preserving transformation from graphs to groups. Using graphs of high Weisfeiler-Leman dimension, we construct highly similar but non-isomorphic groups with equal Θ(log n)-subgroup-profiles, which nevertheless have Weisfeiler-Leman dimension 3. These groups are nilpotent groups of class 2 and exponent p, they agree in many combinatorial properties such as the combinatorics of their conjugacy classes and have highly similar commuting graphs. The results indicate that the Weisfeiler-Leman algorithm can be more effective in distinguishing groups than in distinguishing graphs based on similar combinatorial constructions.

## Authors

• 3 publications
• 19 publications
03/15/2019

### On Cayley graphs of basic algebraic structures

We present simple graph-theoretic characterizations of Cayley graphs for...
07/01/2021

### On the functional graph of the power map over finite groups

In this paper we study the description of the digraph associated with th...
12/28/2020

### Automorphism groups of graphs of bounded Hadwiger number

We determine the structure of automorphism groups of finite graphs of bo...
11/05/2020

### Monadic second-order logic and the domino problem on self-similar graphs

We consider the domino problem on Schreier graphs of self-similar groups...
04/10/2019

### Combinatorial constructions of intrinsic geometries

A generic method for combinatorial constructions of intrinsic geometrica...
01/05/2022

### Graphs with convex balls

In this paper, we investigate the graphs in which all balls are convex a...
06/19/2018

### A unifying method for the design of algorithms canonizing combinatorial objects

We devise a unified framework for the design of canonization algorithms....
##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## 1 Introduction

The notion of isomorphisms between finite groups remains one of the most basic concepts of group theory for which we do not have efficient algorithmic tools. The algorithmic Group Isomorphism Problem formalizes the task of deciding whether two given (finite) groups are isomorphic, but in fact, we do not understand its complexity. We have neither a polynomial time algorithm for testing isomorphism, nor complexity theoretic evidence indicating to us that the problem is not polynomial time solvable. Considering groups of order , a simple approach, attributed to Tarjan in [28], is to pick a small generating set in one of the groups and to check for all possible images of the generators in the other group, whether the partial map extends to an isomorphism. This approach gives us a worst-case runtime of where  is the size of the generating set. Since every group of order  has a generating set of size at most , this yields in the worst case. Despite decades of active research this bound has seen only slight improvements for the general case. In fact, Rosenbaum [33] was able to improve it to . (See [26] and [34] for related discussions on isomorphism of -groups and solvable groups). For various classes of groups, better bounds are known (see further related work). However, even very limited classes of groups provide hard cases for isomorphism testing. One of the most prominent classes in this context is formed by the groups of prime exponent and nilpotency class . Such groups possess a lot of extra structure, but despite this and despite a large body of research into this structure, even for this limited class, no better general bound has been proven. In fact, this class seems to be at the core of the problem. However, a formal reduction to this or a similar class is not known.

While there exists a vast collection of algebraic methods and heuristics for tackling the group isomorphism problem (see further related work), complexity theoretic and combinatorial aspects seem to be less developed. For example, in 2011, Timothy Gowers asked on Lipton’s blog

[16] whether there is an integer  such that the isomorphism class of each finite group is determined by their -subgroup-profile. Here the -subgroup-profile (or -profile) is the multiset of (isomorphism types of) -generated subgroups. Glauberman and Grabowski gave a negative answer by constructing pairs of non-isomorphic groups with the same -profiles [14]. Subsequently, Wilson constructed many examples of exponent and nilpotency class groups which agree in various invariants. In particular they have the same -profiles [39], which is best possible.

The observation that combinatorial aspects of the group isomorphism problem are less developed is surprising since, for the related graph isomorphism problem, historically, it has been the other way around. Indeed, for graph isomorphism testing, combinatorial approaches are well-developed and often successful, yet their limits have been firmly established. One of the most important tools in this scope is the Weisfeiler-Leman algorithm. The -dimensional Weisfeiler-Leman algorithm (

-WL) iteratively classifies

-tuples of vertices of a graph in terms of how they are related to other vertices in the graph. It provides an effective invariant for graph-non-isomorphism (see e.g. [36, 7]). Moreover, -WL can be implemented to run in time where is the number of vertices (see [21, 22]). For fixed , the algorithm is only a partial isomorphism test, in that it can distinguish certain pairs of non-isomorphic graphs, but not all of them. A graph is said to have WL-dimension at most , if -WL distinguishes the graph from every non-isomorphic graph. For many important classes of graphs the WL-dimension has been shown to be bounded; examples include planar graphs [18, 24] for which even  suffices and more generally classes defined by forbidden minors [19]. On the other hand, Cai, Fürer and Immerman constructed an infinite family of graphs, for which the WL-dimension is linear in the number of vertices, and thus unbounded [7]. Higher dimensional versions of -WL also appear in Babai’s breakthrough result putting graph-isomorphism in quasi-polynomial time [1].

There is a deep and well-understood connection between -WL and the expressiveness in the logic , the extension of the -variable fragment of first order logic on graphs with counting quantifiers [7]. For example, two graphs can be distinguished by -WL exactly if there is a formula in  that distinguishes the graphs. Therefore, in some well-defined sense, the -WL algorithm is universal in that it simultaneously checks all combinatorial properties in an input graph expressible in the aforementioned logic.

Contribution. The first aim of this paper is to introduce Weisfeiler-Leman-type algorithms and the notion of a WL-dimension for groups analogous to the graph case. While at first sight it seems straightforward to do so, it turns out that various concepts that coincide when applied to graphs (potentially) disagree when applied to groups. Specifically, we define three natural but different versions of a Weisfeiler-Leman dimension. One of them is based on a natural logic for groups while another is natural when taking an algorithmic viewpoint. The third version comes from natural translation of groups into graphs in an isomorphism and non-isomorphism preserving manner. Still, we give descriptions in terms of counting logics and bijective pebble games for each of the versions. A core reason why the different versions arise is that the correspondence between the various concepts arising in this context (specifically logics, algorithms and pebble games) is not as clean as for graphs. However, we argue that the definition is robust after all: we prove that the Weisfeiler-Leman dimensions of the different versions are linearly related. Overall, we obtain a family of algorithms that is similarly universal in checking combinatorial properties as in the graph case. For example, it is easy to see that the -WL algorithm implicitly computes the -profile of groups. In particular, abelian groups are completely identified already by the least powerful of the algorithms.

The second aim of this paper is to understand when and how groups are characterized by their combinatorial properties. On the one hand this addresses the question whether combinatorial methods can solve the Group Isomorphism Problem. On the other hand it provides a way of quantifying similarity of non-isomorphic groups. Specifically, we construct pairs of arbitrarily large non-isomorphic groups that agree with respect to many isomorphism invariants but can still be distinguished with the -dimensional WL-algorithm. More precisely these groups are of nilpotency class and prime exponent . They are non-isomorphic but have the same -profile. They also have highly similar commuting graphs.

###### Theorem 1.1.

For infinitely many  there exist pairs of non-isomorphic groups order  with bounded Weisfeiler-Leman dimension which

• have equal -profiles,

• have commuting graphs that are indistinguishable for the -dimensional Weisfeiler-Leman algorithm (for graphs),

• are of exponent and nilpotency class , and

• have equal sizes of conjugacy classes.

The theorem shows that the Weisfeiler-Leman algorithm can be more effective in distinguishing groups than in distinguishing graphs even when they are based on similar combinatorial constructions. The proof that the WL-dimension is low intuitively indicates that the ability to fix products of elements appears to be related to the ability to fix sets of elements and how to exploit this.

In comparison to the previous constructions mentioned above, our construction has the advantage that it is of a purely combinatorial nature. It is therefore easy to analyze the groups, and many combinatorial properties of the resulting groups can be tuned. In fact, we can start with an arbitrary graph and encode it into a group while preserving isomorphisms. We should stress that even though we start with graphs of unbounded Weisfeiler-Leman dimension, the resulting groups have only dimension 3. This highlights the power of Weisfeiler-Leman-type algorithms to distinguish groups beyond the scope of traditional invariants.

### 1.1 Further related work

Our work can be understood as studying the descriptive complexity of finite groups. We refer to Grohe’s monograph [19] for extensive information on the descriptive complexity of graphs (rather than groups). A central result in [19] shows graph classes with a forbidden minor have bounded WL-dimension. A recent paper relating first order logics and groups is [29]. The descriptive complexity of finite abelian groups has been studied in [15]. However, descriptive complexity of groups has been investigated considerably less than that of graphs. In contrast to this, the research body on the algorithmic Group Isomorphism Problem is extensive. The results can generally be divided into research with a more practical and research with a more theoretical focus.

On the practical side the best algorithms for isomorphism testing are typically implemented in computer algebra systems such as SAGE, MAGMA, GAP. Classical algorithms include the one by Smith [35] (for solvable groups), the one by Eick, Leedham-Green and O’Brien (for -groups) [12, 30], as well as a general algorithm by Cannon and Holt [9]. Newer algorithms have been developed by Wilson [38] with numerous improvements over time together with Brooksbank and Maglione [6]. More recent work introduces ever stronger invariants to distinguish groups quickly. We refer to [5] for an overview and the most recent techniques and an algorithm incorporating many of them. Dietrich and Wilson report that current isomorphism tests are already infeasible in practice on some groups with orders in the thousands [11].

In any case, in our work we focus on the theoretical side. As mentioned before, the best bound for the general problem is by Rosenbaum [33]. Polynomial time algorithms have been developed for various classes of groups [2, 3, 4, 10, 13, 17, 23, 32]. There is an algorithm running in polynomial time for most orders [11]. For the currently fastest isomorphism algorithm for permutation groups see [37].

Recent efforts incorporate the Weisfeiler-Leman algorithm into the group isomorphism context [5, 25]

. However, there is a crucial difference to our work. Indeed, in these papers the authors use a combinatorial construction within the groups acting on vector spaces on which the (graph) WL-algorithm is executed. This is different to the general algorithm for all groups defined here. Thus, a priori the two algorithmic approaches are unrelated, warranting further study.

## 2 Preliminaries and notation

#### Groups.

Groups will be denoted by capital Latin characters. For a group and elements we write their commutator as and we use to refer to the subgroup of generated by all commutators. Then is the unique minimal normal subgroup of with abelian quotient. The centralizer of is and then is the center of . For a prime , a group is called a -group if is a power of (in particular, we assume to be finite here). The exponent of a group is the least common multiple of the orders of its elements. A -group is elementary abelian if it is abelian and of prime exponent (i.e., for some ). The Frattini-subgroup of a group is the intersection of all maximal subgroups. If is a -group then is the unique minimal normal subgroup of with elementary abelian quotient. The elements of are non-generators in , that is, if generates then so does .

We define a -fold commutator to be just a regular commutator and then a -fold commutator is an element of the form with and a -fold commutator in . A group is said to be nilpotent if there is some integer such that -fold commutators are always trivial in and if this is the case then the nilpotency class of is the smallest such . For example abelian groups are exactly the groups of nilpotency class and a group has nilpotency class if and only if it is non-abelian and every commutator is central.

A group isomorphism is a bijective map that preserves group multiplication. We collect all isomorphisms between and in a (possibly empty) set and set . We write for the set of all subgroups of .

We assume the term ’group’ to mean ’finite group’ and whenever we include infinite groups we do so explicitly.

#### Graphs.

All graphs will be finite simple undirected graphs and referred to with greek characters, primarily , subject to suitable subscripts. That is, a graph consists of a finite set of vertices and a set of edges . The complement of will always be the simple complement graph, namely . The set of neighbors of is and is the closed neighborhood of . The degree of is . A graph is -regular if every vertex has degree . For a set of vertices , the induced subgraph is .

An isomorphism of graphs is a bijective map that simultaneously preserves edges and non-edges. The set of isomorphisms between and is and define .

The commuting graph of a group is the graph whose vertices are the group elements and two distinct elements  are adjacent if .

### 2.1 The WL-algorithm for graphs

Before we explore how the WL-algorithm can be applied to groups, we briefly recapitulate its classic definition for graphs. Given a graph , the -dimensional version of the algorithm for positive  repeatedly colors the -tuples of vertices with abstract colors that encode how each tuple is situated within the graph. The initial coloring of each tuple  encodes the isomorphism type of the graph induced by , taking into account where the vertices occur in the tuple. Specifically, a coloring  into some set of colors is defined so that  holds exactly if there is an isomorphism from to  which sends  to  for all .

The coloring is now iteratively refined as follows. For a tuple  and , define  to be the tuple  obtained by replacing the -th entry with . Then we define for  the coloring

 (χi−1(¯g),{{(χi−1(¯g|1←x),…,χi−1(¯g|k←x))∣x∈V(Γ)}}).

Here  denotes multisets. Thus the color of the next iteration consists of the color of the previous iteration and the multiset of colors obtained by replacing each entry in the tuple with another vertex from the graph. For  the definition is slightly different, namely that for  the multiset is only taken over vertices  in the neighborhood .

Adding the color of the previous iteration as first entry ensures that the partition induced on  by  is finer than (or as fine as) the partition induced by . Let  be the least positive integer for which the partition induced by  agrees with the partition induced by , then we define the final coloring  to be . Since the domain of the  has size , we know that . For fixed , it is possible to compute the partition of  in time  [21].

To distinguish two non-isomorphic graphs the algorithm is applied on the disjoint union. If in the final coloring the multiset of colors appearing in one graph is different than those appearing in the other graph, then the graphs are not isomorphic. The converse does not necessarily hold, as we explain next.

### 2.2 The CFI-graphs

As mentioned previously, for each  there is a pair of non-isomorphic graphs not distinguished by -WL.

###### Theorem 2.1 (Cai, Fürer, Immerman [7]).

There is an infinite family of pairs of non-isomorphic 3-regular graphs on  vertices not distinguished by the -dimensional Weisfeiler-Leman algorithm.

In the original construction the base graph is usually thought of as vertex colored with all vertices obtaining a different color. This makes all gadgets distinguishable. The colors can be removed by attaching gadgets retaining the property that the base graph is identified by 2-dimensional Weisfeiler-Leman. We want to record here the observation that it is possible to choose the base graph of WL-dimension 2 while maintaining the property that it is 3-regular.

###### Observation 2.2.

The 3-regular base graph  can be chosen to have Weisfeiler-Leman dimension at most 2.

This can be seen in two ways, by adding gadgets on edges or by observing that random expanders, usually used in the construction, have this property.

### 2.3 First order logic with counting

There is a close connection between the Weisfeiler-Leman algorithm of dimension  and the -variable fragment of first order logic on graphs with counting quantifiers [7]. To obtain this logic we endow first order logic with counting quantifiers. The formula  expresses then the fact that there are at least  distinct elements that satisfy the formula . For example the formula  would express that the graph contains at least 3 vertices of degree at least 4. The logic  is the fragment of said logic which allows formulas to only use  distinct variables (that can however be reused an arbitrary number of times). We refer to [21] for a more thorough introduction to these logics and a proof that two graphs can be distinguished by -dimensional WL exactly if there is a formula in  that holds on the one graph but not on the other. Often such logics are endowed with a fixed-point operator, but since we will only apply the formulas to structures of fixed size, this will not be necessary for us (see [31] for more information).

### 2.4 The pebble game

There is a third concept, the bijective pebble game [20], that has a deeper connection to the logic  and the -WL. This game is often used to show that graphs cannot be distinguished by -WL. The game is an Ehrenfeucht-Fraïssé-type game with two players Duplicator and Spoiler. Initially  pairs of pebbles, each pair uniquely colored, are placed next to two given input graphs . Each round proceeds as follows: Spoiler picks up a pebble pair  of pebbles of the same color. Then Duplicator chooses a bijection  from  to . Then Spoiler places pebble  on a vertex  and places  on . Spoiler wins if at any point in time the graph induced by the vertices occupied by pebbles in  is not isomorphic to the graph induced by the vertices occupied by pebbles in  via a map that sends a pebble  to its corresponding pebble of the same color  in the other graph. Spoiler also wins (in round 0) if .

When using  pebbles on two graphs, the game can be won by Spoiler exactly if -WL distinguishes the graphs [20].

## 3 WL-type algorithms on groups

As with graphs we would like to be able to study combinatorial properties of finite groups using WL-type algorithms. The natural approach is to adapt the methods from the last section to suit (finite) groups. However, depending on the interpretation of these methods, we will obtain several different choices for initial colorings and refinement strategies for finite groups. We will argue that different methods are all in some sense natural and interesting in their own right. However, the different concepts (possibly) lead to different notions of Weisfeiler-Leman dimension for groups. In contrast to this, for graphs, all notions are equivalent. While we are not able to precisely determine whether for groups the different methods are equally powerful at this point, we do however show that exchanging one method for another changes the dimension by at most a constant factor.

### 3.1 Weisfeiler-Leman algorithms for groups

The following algorithms define color-refinement procedures on -tuples of group elements. Since groups are (essentially) ternary relational structures, we will usually require for the dimension that . In the following let  be a group. We will define three versions of the WL-algorithm for groups.

#### Version I:

Define an initial coloring  on -tuples of group elements so that and obtain the same color if and only if for all indices  we have  exactly if  and for all indices we have exactly if . We iteratively define the refinement  in the classical way just like it is defined for graphs, that is for we have

 (χi−1(¯g),{{(χi−1(¯g|1←x),…,χi−1(¯g|k←x))∣x∈G}}).

#### Version II:

In the definition for graphs, the initial coloring of a tuple takes into account the subgraph induced by the tuple. In analogy to this, one might argue that for groups the initial coloring needs to take into account the subgroup generated by the tuple. Thus, in Version II, we define an initial coloring  on -tuples of group elements such that and obtain the same color if and only if there is a map with which extends to an isomorphism from  to . In this case we will also say the tuples agree in their marked isomorphism type. The iterative refinement is again performed in the classical way.

#### Version III:

For Version III, we encode groups as graphs, execute the WL-algorithm for graphs and pull back the coloring. For this choose an isomorphism-preserving, invertible functor that maps finite groups to finite (simple) graphs . Our working example will be the following construction but other choices are certainly possible and many choices will lead to equivalent or at least related algorithms.

To obtain the graph (see Figure 2), start with a set of isolated nodes corresponding to elements of the group . For each pair of group elements add a multiplication gadget by adding 4 nodes  and add the edges

 {{g,agh},{hgh,bgh},{gh,dgh},{agh,bgh},{bgh,cgh},{cgh,dgh}}.

We then use the classical -dimensional WL-algorithm on the graph and pull back the colorings of -tuples by simply restricting it to .

By construction we have and due to vertex-degrees is a canonical subset of the vertices of . Thus for two groups  we have  if and only if .

Many other reductions of this form transforming groups to graphs are possible. However, some of them are artificial. For example, one could artificially ensure that the resulting graph has low WL-dimension by precomputing certain isomorphism-invariants not captured by the WL-algorithm. Thus, a unified treatment of all isomorphism-preserving constructions seems infeasible. However, it seems that for many ’well-behaved’ functors the WL-dimension of the constructed graphs differ by a constant factor only. On another note, it would be interesting to obtain efficiently computable subquadratic reductions from groups to graphs, but we are not aware of such a construction.

For fixed , each version of the WL-algorithm gives rise to a polynomial-time (possibly) partial isomorphism test on pairs of finite groups. Indeed, marked isomorphism of -tuples in a group can be checked in time so we can compute initial colors in time for Versions I and II. The refinement steps are the same as for graphs and thus we obtain the same bound for the rest of the computation. For Version III we have a quadratic blowup yielding time .

###### Definition 3.1.

Groups and are equivalent with respect to -WL in Version , in symbols , if there is a bijection preserving final colors of the respective color-refinement procedure. Furthermore we write if it holds that , i.e., the distinguishing power of is weaker than or equal to the distinguishing power of .

The main result of this section is that we can exchange one version for another when we multiply the dimension with a constant factor. When studying WL-type algorithms it is often useful to have equivalent pebble games at hand, so we first associate a pebble game to each of the variants above.

### 3.2 Bijective k-pebble games

We now define suitable pebble games for the different versions. Each of these games is played by two players Spoiler and Duplicator and in each case we will say that Duplicator wins the game if and only if there is a strategy for Duplicator to keep the game going on forever. The board consists of a pair of finite groups of equal order (or rather their elements) or a pair of corresponding graphs for Version III, respectively. There are  pairs of pebbles . We think of pebbles in the same pair as having the same color, and pebbles from different pairs as having distinct colors. The pebbles can be placed beside the board or on the group elements (graph vertices in Version III), in which case we say a group element is pebbled. Pebbles  are placed on elements of  (vertices of ) and pebbles  on  (). At any point in time the pebbles  give us a pebbled tuple in  (or ), where  indicates that the pebble is placed besides the board.

#### Version I:

All pairs of pebbles are initially placed beside the board. A round of the game consists of these steps:

1. Spoiler picks up a pair of pebbles .

2. Duplicator chooses a bijection .

3. Spoiler pebbles some element with , the corresponding pebble  is placed on .

The winning condition is always checked right after Step 1. At that moment, the pebbles not in Spoiler’s hand then pebble a

-tuple over and a corresponding -tuple over . Spoiler wins if the pebbled tuples differ with respect to the initial coloring of Version I. (This implies that no more pebbles are placed beside the graph.)

#### Version II:

Version II differs from Version I only in that the winning condition uses the initial coloring of Version II rather than Version I. That is, Spoiler wins if the map induced by pairs of pebbles does not extend to an isomorphism between the subgroups generated by the pebbled group elements, and the game continues otherwise.

#### Version III:

Version III is the (classical) bijective -pebble game for graphs played on and (see Subsection 2.4).

In the pebble games, when we say that “Duplicator has to do something”, we mean that otherwise Spoiler wins the game. We say that Duplicator respects a certain property of group elements if Duplicator always has to pebble pairs of groups elements which agree in whether they have the property. One can show that Duplicator must respect the partial mapping given by the pairs of pebbles that are currently on the board. Indeed, otherwise Spoiler can win in the next round by pebbling the location where this is violated.

For each game we can also use initial configurations of pebbled tuples instead of starting from empty configurations.

Remark: Color refinement and pebble games are not necessarily restricted to finite groups. While not clear that the results are computable, they still may be of theoretical interest. The same goes for the logics defined next.

### 3.3 Logics with counting

As for graphs, the -dimensional refinement on groups can also be interpreted in terms of first-order counting logic.

Recall the central aspects of first order logic. There is a countable set of variables . Formulas are inductively defined so that  is a formula for all pairs of variables and if  is a formula then , and  are formulas. The semantics are defined in the obvious way. First order logic with counting allows additionally formulas of the form with the semantic meaning that there are at least  distinct elements that satisfy .

To define logics on groups we need to additionally define a relation that relates to the group multiplication.

#### Version I:

In Version I we add a ternary relation  with which we can create terms of the form . The semantic interpretation is that  holds if . We call  the first order logic with counting on groups arising this way and let  be its -variable fragment.

#### Version II:

For  we use a different relation to access multiplication: The relation  holds, where  is a word in the , if multiplying the elements according to  gives the trivial element. For example in an abelian group  the relation  would hold for all elements . The relation  would only hold if  is the trivial element. We let  be the -variable fragment of the logic. Note that for  it actually suffices to use only  entries in the relation.

#### Version III:

The natural choice of logic for Version III is of course the classical first order logic with counting  on graphs as discussed in the preliminaries (Subsection 2.3), where we have the relation  to encode edges. For notational consistency we define to be the -variable fragment of this logic.

### 3.4 Equivalence between the different concepts

For each of the versions we have defined, we sketch the arguments for equivalence of the expressive power between the WL-algorithm, the pebble game, and the corresponding logic. Let us fix groups and of the same order. The argument basically follows other well known arguments to show such equivalences (see e.g., [7]).

###### Theorem 3.2.

Two groups and are distinguished by the -WL-refinement (Version ) if and only if the same holds for the bijective -pebble game (Version ).

Remark: Let us remark on a small detail where the group situation can differ from that of graphs. Note that in our definition of the game, the winning condition is only ever checked after Step 1. We could also check the winning condition when  pebble pairs are situated on the group after a round is finished. For this we would need an initial coloring that works with  tuples. For graphs this change does not make a difference, since the winning condition only ever depends on 2 pebble pairs. Similarly for Version I, where the winning condition occurs due to 3 pebble pairs, if  then it is irrelevant when we check the winning condition. However, for Version II we are not so sure how the power of the game changes, when altering the moment at which the winning condition is checked.

###### Theorem 3.3.

if and only if there is a sentence in  that holds on one of the groups but not the other.

The rest of this section contains the proof of Theorems 3.2 and 3.3.

###### Lemma 3.4.

Suppose and . If and obtain different colors in the -th iteration of -dimensional WL-refinement then Spoiler can win the -pebble game in moves on initial configuration . (Here we use the same version for WL-refinement and pebble game.)

###### Proof Sketch.

(Version I.) For there is nothing to show. Assume now that . By assumption and are different which means that either we already have or there is no color-preserving matching between the tuples for and tuples for . In other words, no matter which bijection with Duplicator chooses there will be some and some position such that and Spoiler can make progress by changing the -th pebble from to . By induction, Spoiler now has a winning strategy with moves while having moved at most once.

(Version II.) If then and differ with respect to marked isomorphism, thus Spoiler can win without moving at all. For the argument is the same as before since the refinement steps are defined equally.

(Version III.) This is exactly the classical result for graphs, see [20, 7]. ∎

###### Lemma 3.5.

Suppose and . If Spoiler can win the -pebble game in moves on initial configuration then and obtain different colors in the -th iteration of -dimensional WL-refinement. (Again we use the same version for WL-refinement and pebble game.)

###### Proof sketch.

(Version I.) If then the initial configuration is already a winning one for Spoiler which is by definition the same as -tuples getting different initial colors. By induction, for any bijection Duplicator may choose, Spoiler can reach in one move a configuration where and for some position and such that . Since this is true for any possible bijection, the tuples and already have to differ with respect to .

(Version II.) The argument is the same as for Version I.

(Version III.) This is again a classical result [20, 7]. ∎

###### Proof of Theorem 3.2.

Theorem 3.2 follows immediately from the previous two lemmas. ∎

It remains to argue the equivalences between the logic and the pebble game for each of the versions. This again basically follows from known techniques.

We first argue that for Version I and II the quantifier free formulas of the -variable fragment of each version characterize the initial colorings.

###### Lemma 3.6.

There is a quantifier free -variable formula distinguishing -tuples and if and only if these tuples differ in their initial coloring in version .

###### Proof.

If then distinguishes the tuples and if and only if there is an atomic statement of the form or , interpreted as , with respect to which and differ. This is precisely the definition of the Version I initial coloring. For Version , if some word over is (non)trivial but the corresponding word over is not then clearly mapping to does not extend to an isomorphism. Assume now that and have different marked isomorphism types and w.l.o.g. we have . By assumption every injective map between these groups extending is not multiplicative. This fact can be expressed in terms of a suitable word over symbols separating from . ∎

###### Lemma 3.7.

Suppose and . For each Version , the tuples and are distinguished by -WL if and only if there is a formula  in  such that .

###### Proof sketch.

(Version I.) For Version I, due to Lemma 3.6, the expressive power of the initial coloring is precisely the expressive power of quantifier-free formulas. The distinguishing power of the WL-algorithm on groups is thus equal to distinguishing power of the classical algorithm executed on a structure that is already endowed with the initial coloring. The equivalence between the -variable fragment of the logic and the -WL algorithm for Version I on groups thus follows from the respective equivalence for graphs shown in [7].

(Version II.) For Version II the argument is the same as for Version I except that we add the following observation: Since  and  are finite groups there is only a finite number of nonequivalent quantifier free formulas over . By Lemma 3.6 tuples can be distinguished exactly if they obtain different colors in the initial coloring of Version II.

(Version III.) This is again a classical result [7]. ∎

###### Proof of Theorem 3.3.

Theorem 3.3 follows immediately from the previous two lemmas. ∎

### 3.5 Relationship between the different WL-algorithm versions

Next, we want to relate different versions to each other and we will do so by exploiting the equivalence to pebble games.

###### Definition 3.8.

Consider the -pebble game on graphs and and assume that a pair of pebbles is placed on vertices corresponding to multiplication gadgets and (but not on vertices corresponding to group elements). Then the pairs and will be called implicitly pebbled. Note that implicit pebbles always induce a pairing of group elements.

Intuitively, pebbling a vertex in a multiplication gadget is as strong as pebbling two group elements simultaneously, hence the definition of implicit pebbles. It can be shown that Duplicator has to respect the gadget structure and in particular the multiplication structure of the implicitly pebbled elements.

###### Theorem 3.9.

For all we have .

The rest of this section spans the proof of this theorem.

###### Lemma 3.10.

Consider the -pebble game on graphs and . If  and one of the following happens

1. Duplicator chooses a bijection with ,

2. after choosing a bijection, there is a pebble pair , for which pebble  is on some vertex of (not on , or ) and  is on some vertex of but , or

3. the map induced on group elements pebbled or implicitly pebbled by  pebbles does not extend to a group isomorphism between the corresponding generated subgroups

then Spoiler can win the game.

###### Proof.
1. In vertices corresponding to group elements have degree while other vertices have degree or .

2. From now on always assume . Write and . Let for some and put a pebble  other than  on and the corresponding one  on . If pebble  is not on the same type of vertex (i.e., Type or , see Figure 2) as pebble  then Spoiler wins, since either the vertices have different degrees or their neighbors have different degrees.

Now the pebbled vertex in is connected to directly or via a path of non-group element vertices and for and either this is not the case or the path uses different types of vertices. Using a third pebble pair Spoiler can explore this path and win on a configuration of three pebbles.

3. By assumption there are at most implicitely pebbled pairs of group elements corresponding to at most pebbles that are currently on the board. We may assume that there are exactly such pairs, say. By the second part of this lemma Duplicator has to choose some bijection such that respecting the pairing induced by indirectly pebbled group elements. By assumption this correspondence does not extend to an isomorphism between and so there must be a smallest word over such that

 f(w)≠f(gi1)…f(git).

Spoiler can use an additional pair of pebbles to fix this image of . Now Duplicator chooses a new bijection on the remaining group elements. There is now either a smaller word over with this property, in which case Spoiler moves the last pebble pair we just introduced to this new word and its image, or is still minimal with this property. The first case can only occur finitely many times and if Spoiler wins by part . Thus assume that is still minimal. But then

 f′(gi1)f′(gi2…git)=f′(gi1)f′(gi2)…f′(git)≠f′(w)

and using a second additional pair of pebbles (now a total of at most pairs of actual pebbles) Spoiler can also fix the image of to be and clearly wins from this configuration in at most two further rounds.

If then .

###### Proof.

Assume that Spoiler wins the -pebble game in Version II. The idea is to simultaneously play a Version II game on groups and a Version III game on graphs. For this purpose we have to be able to compare pebble-configurations from the different games. Let be a configuration of pebbled -tuples on and and call a configuration on graphs admissible if it looks as follows: There is one pair of pebbles on the multiplication gadgets and , another pair on and and so forth. If

is odd then there is another pair of pebbles on vertices

and and there are no other pebbles on the graphs. Note that the number of pebbles on each graph is and that implicit pebbles (together with the pebbles on ) correspond exactly to the pebbles on groups in Version II. Using Lemma 3.10 we can assume throughout the game that Duplicator chooses bijections on graphs that restrict to bijections on groups and that those restrictions respect implicit pebbles or otherwise Spoiler would win Version III right away. That means that given an admissible configuration, the bijection Duplicator chooses in Version III can be used as a Version II bijection as well. Spoiler will then move in Version II and we argue that Spoiler can win in Version III or force Duplicator into another admissible configuration. Since Spoiler can choose arbitrary moves in Version II, by assumption Spoiler will win in Version II at some point. Using Lemma 3.10 again, we see that Duplicator will eventually lose the Version III game on this configuration. It remains to argue that Spoiler can maintain admissible configurations. Assume Duplicator chose a bijection as above. There are two cases: Spoiler moves a pebble or introduces a new one. Suppose Spoiler introduces a new pebble pair on and in the groups. If  is even the new pebble on is grouped with the already existing pebble on . In the graph, Spoiler will put a pebble on . The corresponding pebble should be put on to obtain an admissible configuration. But since was not necessarily (implicitly) pebbled it may be the case that does not map to . To fix this, Spoiler first pebbles and directly, using one additional pebble, and asks for another bijection. By Lemma 3.10 this bijection must now map to and Spoiler reaches an admissible configuration in Version III in two more moves, removing the additional pebble again. The case where a pebble is moved rather than newly introduced can be treated in the same way. ∎

If then .

###### Proof.

We now want to reverse the argument from the last lemma. Given a pebble-configuration on graphs and we call a pebble-configuration on groups admissible if the following holds: for each pair of pebbles on element-vertices the corresponding elements in and are pebbled as well and for each pair of pebbles on non-element vertices, that is, pebbles on gadgets and , there are pairs of pebbles on and , and , respectively. Note that, w.l.o.g., (non-)element-vertices are only pebbled among each other by Lemma 3.10. Also the number of pebbles on groups in an admissible configuration is at most twice the number of pebbles on graphs. Since Spoiler can move two implicit pebbles at once in Version III we will look at two consecutive rounds of the Version I game at once. Let Duplicator choose a bijection in the Version I game. For each possible Spoiler move introducing an additional pebble on , Duplicator has to commit to one bijection on the new configuration. We can force Duplicator to choose this bijection in the corresponding configuration from now on without changing the deterministic outcome of the game, because Duplicator is allowed to choose it freely once. This gives rise to a bijection between pairs of group elements mapping to . Note that this happens without actually making moves, rather think of Duplicators strategy as being precomputable by Spoiler due to the deterministic nature of the game. The map on pairs can now be interpreted as a mapping between element vertices together with a mapping of corresponding multiplication gadgets and will be used as the next Duplicator move in the Version III game. If the Spoiler move in Version III moves two implicit pebbles at once, Spoiler can reach an admissible configuration in three rounds (one additional round for discarding the additional pebble) in the Version I game while Duplicator chooses bijections according to the precomputed strategy.

Finally, before Spoiler wins in Version III, Spoiler will win in Version I. More precisely, as long as the map on pebbles in the Version I game is multiplicative, the corresponding map induced on the pebbled subgraph will be a graph isomorphism, since multiplicativity on pebbles can be expressed equivalently in terms of mapping gadgets accordingly. ∎

###### Proof of Theorem 3.9.

The first inclusion is clear. The other inclusions are the content of the previous lemmas. ∎

We remark that the additive constants in the Theorem 3.9 could be improved for by reusing pebbles, but we do not worry about explicit constants at this point. It is also possible to show directly.

## 4 Embedding graphs into finite groups

Next, we describe a construction of finite groups from graphs such that structural properties of the resulting groups are primarily determined by the graphs. We will make this statement more precise in the following. From now on fix an odd prime .

###### Definition 4.1.

For each natural number there is a relatively free group of exponent and (nilpotency) class generated by elements. It admits a finite presentation

 Fn,p=⟨x1,…,xn∣R(p,n)⟩

where consists of the following relations:

1. For all there is a relation , and

2. for all there is a relation .

Thus, the group is generated by , each of these generators is an element of order , and the commutator of two generators commutes with every generator and thus every element of the group. It follows from these properties that elements of can be uniquely written as

 xd11⋅…⋅xdnn[x1,x2]d1,2[x1,x3]d1,3⋅…⋅[xn−1,xn]dn−1,n

where exponents are defined modulo . In particular, .

The main goal is to construct quotients of using graphs on vertex set  as templates in a way that translates combinatorial similarity of the graphs (with respect to Weisfeiler-Leman-refinement) to similar subgroup profiles. We will see that this affects other isomorphism invariants as well.

###### Definition 4.2.

To each (simple, undirected) graph and prime number we assign a finite exponent group of nilpotency class via

 GΓ:=⟨x1,…,xn∣R(p,n),[xi,xj]=1:{vi,vj}∈E⟩.

Thus, in  two generators  commute, if the corresponding vertices form an edge in . We usually identify with and use the latter to refer to the vertex as well as the respective element of . We fix an order on generators and call these the standard generators for . The particular presentation above is called the presentation of from .

It turns out that this construction has also been used in other contexts. It is sometimes called Mekler’s construction in the literature (see [27] for Mekler’s original work) and has been primarily investigated for infinite graphs with respect to model theoretic properties. We first collect some possibly well known combinatorial and group theoretic properties.

###### Lemma 4.3.

We have and the vertices of form a generating set of of minimal cardinality.

###### Proof.

By construction has exponent and thus (since for -groups the Frattini-subgroup is the minimal subgroup with elementary abelian quotient). The cardinality of a minimal generating set of is the dimension of the -space which is now equal to . We have

 GΓ/G′Γ≅⟨V(Γ)∣exponent p, abelian⟩≅F|V(Γ)|p

showing the claim. ∎

###### Lemma 4.4.

Denote by the number of non-edges in . Then , i.e., the set of non-edges of forms a basis in .

###### Proof.

We have for some normal subgroup with and since commutators are central in we have where . ∎

This also gives us normal forms for elements of .

###### Corollary 4.5.

Let be a (simple) graph. Then we have . In particular, every element of can be written in the form

 vd11…vdnncdn+11…cdn+kk

where is the set of non-trivial commutators between generators (i.e., the non-edges of the graph ) and each is uniquely determined modulo .

We will see that a lot of information on commutation and centralizers can be deduced from directly. We first need to recall some well known properties of commutators in (nilpotent) groups.

###### Lemma 4.6 (Commutator relations).

Let be a group of nilpotency class . Then for all we have

1. and

2. .

In particular for all we have .

###### Proof.

Recall that nilpotency class means that all commutators are central in . We thus have and we have that