Upper Bounds on the Quantifier Depth for Graph Differentiation in First-Order Logic
aa r X i v : . [ c s . L O ] A p r UPPER BOUNDS ON THE QUANTIFIER DEPTH FOR GRAPHDIFFERENTIATION IN FIRST-ORDER LOGIC
SANDRA KIEFER AND PASCAL SCHWEITZERRWTH Aachen University, Lehrstuhl Informatik 7, Ahornstraße 55, 52074 Aachen, Germany e-mail address : [email protected] Kaiserslautern, Algorithms and Complexity Group, Postfach 3049, 67663 Kaiserslautern, Ger-many e-mail address : [email protected]
Abstract.
We show that on graphs with n vertices the 2-dimensional Weisfeiler-Lemanalgorithm requires at most O (cid:0) n / log( n ) (cid:1) iterations to reach stabilization. This in partic-ular shows that the previously best, trivial upper bound of O ( n ) is asymptotically nottight. In the logic setting this translates to the statement that if two graphs of size n can be distinguished by a formula in first-order logic with counting with 3 variables (i. e.,in C ), then they can also be distinguished by a C -formula that has quantifier depth atmost O (cid:0) n / log( n ) (cid:1) .To prove the result we define a game between two players that enables us to decouplethe causal dependencies between the processes happening simultaneously over several iter-ations of the algorithm. This allows us to treat large color classes and small color classesseparately. As part of our proof we show that for graphs with bounded color class size, thenumber of iterations until stabilization is at most linear in the number of vertices. Thisalso yields a corresponding statement in first-order logic with counting.Similar results can be obtained for the respective logic without counting quantifiers,i. e., for the logic L . Introduction
The Weisfeiler-Leman algorithm is a combinatorial procedure that plays a central role in thetheoretical and practical treatment of the graph isomorphism problem. For every k thereis a k -dimensional version of the algorithm, which repeatedly and isomorphism-invariantlyrefines a partition of the set of k -tuples of vertices of the input graph. This process stabilizesat some point and the final partition can often be used to distinguish non-isomorphic graphs.On the practical side, the 1-dimensional variant of the algorithm, which is also calledcolor refinement, is an indispensable subroutine in virtually all currently competitive iso-morphism solvers (such as Nauty and
Traces [MP14],
Bliss [JK07] and saucy [DLSM04]).
Key words and phrases: first-order logic, counting quantifiers, Weisfeiler-Leman, color refinement. ∗ An extended abstract of this paper appeared in the Proceedings of the 2017 32nd Annual ACM/IEEESymposium on Logic in Computer Science (LICS).
Preprint submitted toLogical Methods in Computer Science c (cid:13)
S. Kiefer and P. Schweitzer CC (cid:13) Creative Commons
S. KIEFER AND P. SCHWEITZER
The procedure is also applied to speed up algorithms in other fields, for example in the con-text of subgraph kernels in machine learning [SSvL +
11] or static program analysis [LSS + k -dimensional Weisfeiler-Leman algorithm canbe computed in time O ( n k +1 log n ) (see [BBG13]), but for practical purposes this runningtime is often excessive already for k = 2.On the theoretical side, it is known that for random graphs the 1-dimensional Weisfeiler-Leman algorithm asymptotically almost surely correctly decides graph isomorphism [BES80].Whereas the 1-dimensional algorithm fails to distinguish regular graphs of equal size andequal degree, the 2-dimensional version asymptotically almost surely decides isomorphismfor random regular graphs [Kuc87]. While for every graph class with a forbidden minora sufficiently high-dimensional Weisfeiler-Leman algorithm correctly determines isomor-phism [Gro12] it is known that for every k there are non-isomorphic graphs that are notdistinguished by the k -dimensional algorithm [CFI92]. In his recent breakthrough result,Babai [Bab16] employs a polylog( n )-dimensional Weisfeiler-Leman algorithm to developthe to date fastest isomorphism algorithm, which solves the graph isomorphism problem inquasi-polynomial time.We are concerned with the number of iterations required for the Weisfeiler-Leman algo-rithm to stabilize. More specifically, for n, k ∈ N we are interested in WL k ( n ), the maximumnumber of iterations required to reach stabilization of the k -dimensional Weisfeiler-Lemanalgorithm among all (simple) graphs of size n . This iteration number plays a crucial role forthe parallelization of the algorithm [KV08]. The trivial upper bound of WL k ( n ) ≤ n k − n k . For k = 1, on random graphs,this iteration number is asymptotically almost surely 2 [BES80], but by considering paths,one quickly determines that WL ( n ) ≥ n/ −
1. This bound was recently improvedto WL ( n ) ≥ n − O ( √ n ) [KV15]. For fixed k > k ( n ). Modifying the construction of Cai, F¨urer and Immerman [CFI92],this was achieved by F¨urer [F¨ur01] who showed that WL k ( n ) ∈ Ω( n ), remaining to date thebest known lower bound.Concerning upper bounds, for k ≥
1, no improvement over the trivial upper bound O ( n k )has been known so far and for k = 1 it is indeed asymptotically tight. However, for k = 2,we show that the trivial upper bound is not tight. Theorem 1.1.
The number of iterations of the -dimensional Weisfeiler-Leman algorithmon graphs of size n is at most O ( n / log( n )) . There is a close connection between the 2-dimensional algorithm and matrix multipli-cation that is even more prominent in the context of coherent configurations [Bab95]. Itis possible to execute t iterations of the 2-dimensional Weisfeiler-Leman algorithm by per-forming t matrix multiplications over a certain ring (see [BCKP10], Section 5). However,it is also well-known that using randomization these multiplications can be performed overthe integers (see, for example, [Sch09], Sections 2.9.2 and 2.9.3), yielding a running timeof O ( n ω ), where ω < L k the k -variable fragment of first-order logic and by C k the extension of L k by countingquantifiers of the form ∃ ≥ i . As to the semantics, a graph G satisfies ∃ ≥ i xϕ if there are at PPER BOUNDS ON FO-QUANTIFIER DEPTH 3 least i vertices v ∈ V ( G ) such that G | = ϕ [ v/x ], i. e., the graph G is a model for ϕ via aninterpretation mapping x to v . For a more detailed introduction to L k and C k , we refer thereader to [IL90]. Immerman and Lander showed that two graphs are distinguishable in C k ifand only if they can be distinguished by the k -dimensional Weisfeiler-Leman algorithm. Inthis context, the iteration number of the algorithm corresponds to the quantifier depth ofa formula required to distinguish the graphs (see [PV11]), yielding the following corollary. Corollary 1.2.
If two n -vertex graphs can be distinguished by the -variable first-order logicwith counting C , there is also a formula in C with quantifier depth at most O ( n / log( n )) distinguishing the two graphs. Finally, there are also certain types of Ehrenfeucht-Fra¨ıss´e games that simulate theWeisfeiler-Leman algorithm and in which the iteration number corresponds to the maximalnumber of moves in a shortest winning strategy for Spoiler (see [CFI92]). Thus, from upperbounds on the iteration number of the Weisfeiler-Leman algorithm, we also obtain upperbounds on the length of a shortest winning strategy in these games.Our technique. Our central technique to prove the upper bound consists of defining a newtwo-player game mimicking the mechanics of the Weisfeiler-Leman algorithm. While thefirst player assumes a role of an adversary even stronger than the Weisfeiler-Leman algorithmby being allowed arbitrary refinements, the second player repeatedly rectifies the graph inclean-up steps to maintain various consistency properties for the coloring of the graph. Thistechnique allows us to decouple the causal dependencies between the processes happeningsimultaneously over several iterations of the algorithm. The strategy of the second playertakes into account the sizes of the vertex color classes in the current partition. Definingvertex color classes with sizes beyond a certain threshold to be large, we first bound thenumber of iterations in which color classes are refined that are related in any way with largevertex color classes. We then show that for a fixed threshold, the total amount of iterationsdealing exclusively with small vertex color classes is linear. As a consequence we obtain thefollowing lemma.
Lemma 1.3.
The number of iterations of the -dimensional Weisfeiler-Leman algorithmon graphs with n vertices of color class size at most t is O (2 t n ) . Similarly to Corollary 1.2, the lemma also translates into the logic setting yielding linearbounds on the quantifier depth. The graph classes of bounded color class size repeatedlyplay a role in the context of graph isomorphism. In fact, to show the linear lower boundof WL k ( n ) ∈ Ω( n ), F¨urer constructs graphs of bounded color class size [F¨ur01]. Even forgraphs of bounded color class size, for k = 2, prior to this paper, the only available boundwas the trivial one of WL ( n ) ≤ n −
1. For such classes we now have upper and lowerbounds matching up to a constant factor.Recently Berkholz and Nordstr¨om were able to obtain a new lower bound on the iter-ation number of the k -dimensional Weisfeiler-Leman algorithm for finite structures [BN16].Their construction shows that there are pairs of n -element relational structures that aredistinguished by the k -dimensional Weisfeiler-Leman algorithm, but not within n o ( k/ log k )1 In the literature, such k -variable logics with or without counting are often defined as fragments of fixed-point logics instead of fragments of first-order logic (see e.g. [Ott17]). For our applications, this distinctionis not necessary since we only need formulas for graphs of a fixed size. S. KIEFER AND P. SCHWEITZER refinement steps. This lower bound holds whenever k < n . . Since it is close to the trivialupper bound, one might believe that the upper bound is tight. However, our results show that for k = 2 this is not the case. Moreover, the construc-tion of Berkholz and Nordstr¨om describes finite structures with bounded color class size.Consequently, it seems that Lemma 1.3 may be an obstruction for a modification of theirstructures to graphs with strong lower bounds. Indeed, our theorem says that for graphs ofbounded color class size there is a linear upper bound.2. Preliminaries
In this paper, a colored graph is a tuple G = ( V, E, χ ) with a finite vertex set V and edgeset E = V , in which all edges are assigned colors by the map χ : E → C , i. e., they areassigned values from a particular set C . Note that this definition captures the classicalnotions of directed colored and uncolored graphs since we can reserve a specific color fornon-edges. Furthermore, we can interpret undirected graphs as colored graphs where forall u, v ∈ V , we have χ ( u, v ) = χ ( v, u ). Thus, simple graphs (i. e., undirected graphs withoutloops at vertices) are also special cases of colored graphs with respect to our definition.If it is clear from the context, we sometimes simply talk about graphs and drop theattribute “colored”. For the coloring function χ , we suppose that the set of colors of loopsand the set of colors of other arcs are disjoint, that is, we have (cid:8) χ ( u, u ) | u ∈ V (cid:9) ∩ (cid:8) χ ( u, v ) | u, v ∈ V, u = v (cid:9) = ∅ . Let G = ( V, E, χ ) be a colored graph with coloring χ : E → C .Throughout the paper we assume that χ ( v , u ) = χ ( v , u ) if and only if χ ( u , v ) = χ ( u , v ) for any coloring χ we consider. We say the coloring respects converse equivalence .(We do not lose generality with this assumption since the 2-dimensional Weisfeiler-Lemanalgorithm defined below maintains this property of colorings. See Appendix A for a moredetailed discussion.)The in-neighborhood of a vertex v ∈ V with respect to a set of colors C ′ ⊆ C is the set N −C ′ ( v ) := { u | u ∈ V, χ ( u, v ) ∈ C ′ } . Likewise, the out-neighborhood of v with respect to C ′ is the set N + C ′ ( v ) := { u | u ∈ V, χ ( v, u ) ∈ C ′ } . The color in-degree of v with repect to the set C ′ is the number d −C ′ ( v ) := | N −C ′ ( v ) | . The color out-degree is defined analogously. When talking about color degrees , we mean colorin-degrees and color out-degrees.The coloring χ induces a partition π ( χ ) of V : A color class of G is a set of 2-tuplesthat all have the same color. Since we are only interested in the color classes induced by thecolorings we consider, and not in the actual colors, we do not distinguish in our notationbetween a color C and the corresponding class of 2-tuples.A vertex color class is a color class only consisting of tuples of the form ( v, v ) with v ∈ V .Similarly, an edge color class is a color class that consists only of tuples of the form ( v, w )with v, w ∈ V and v = w . As the term vertex color class already implies, we implicitly In fact, Berkholz’s individual result in [Ber14] yields the tightness of the trivial upper bound of O ( n )for a logic fragment which is related to our fragments of counting logics, namely for the 3-variable existentialnegation-free fragment of first-order logic. PPER BOUNDS ON FO-QUANTIFIER DEPTH 5 identify every vertex tuple ( u, u ) with the corresponding vertex u . Consequently, we usethe abbreviation χ ( u ) for χ ( u, u ).For a set S ⊆ V and a vertex color class C , we say that S is incident with C if thereexists a ( u, v ) ∈ S with ( u, u ) ∈ C or ( v, v ) ∈ C .For two partitions π and π ′ , we say that π ′ is finer than π if every element of π ′ iscontained in an element of π . We write π (cid:23) π ′ (and equivalently π ′ (cid:22) π ) to express that π ′ is finer than π . Accordingly, we say that π is coarser than π ′ . For a coloring χ we denoteby π ( χ ) the induced partition of V .For two colored graphs G = ( V, E, χ ) and G ′ = ( V ′ , E ′ , χ ′ ), we say that G ′ refines G (and equivalently, that G ′ is a refinement of G ) if V = V ′ and π ( χ ) (cid:23) π ( χ ′ ). Slightlyabusing notation, we write G (cid:23) G ′ in this case. If both G (cid:23) G ′ and G ′ (cid:23) G hold, wewrite G ≡ G ′ and call the two colored graphs equivalent . Similarly, in the games we define,we say that players refine their input graph G = ( V, E, χ ) if they recolor the edges of G ina such way that the new induced partition of V is finer than π ( χ ).2.1. The Weisfeiler-Leman algorithm.
By iteratively refining a partition of the set ofvertex tuples of its input graph, the Weisfeiler-Leman algorithm computes a stable partitionof the graph. For every k ∈ N , a k -dimensional variant of the algorithm is defined. We aremainly concerned with the 2-dimensional variant that we describe next. Definition 2.1 (the 2-dimensional Weisfeiler-Leman refinement) . Let χ : V → C be acoloring of the 2-tuples of vertices of a graph G , where C is some set of colors. We definethe 2 -dimensional Weisfeiler-Leman refinement G r to be the graph G with the coloring χ r satisfying χ r ( v , v ) = (cid:0) χ ( v , v ); M (cid:1) where M is the multiset defined as M := (cid:8)(cid:8)(cid:0) χ ( w, v ) , χ ( v , w ) (cid:1) (cid:12)(cid:12) w ∈ V (cid:9)(cid:9) . It is not difficult to see that π ( χ ) (cid:23) π ( χ r ).For a colored input graph G , we set G (0) := G and G ( i ) := ( G ( i − ) r for i ≥
1. Exe-cuting i iterations of the 2-dimensional Weisfeiler-Leman algorithm means computing G ( i ) .The output of the 2-dimensional Weisfeiler-Leman algorithm on input G is G ( k ) , where k isthe smallest integer satisfying G ( k ) ≡ G ( k +1) . We denote this graph by e G . We call G andthe induced partition of the 2-tuples of its vertices stable if G = e G . Accordingly, we call e G the stabilization of G .The stable partitions of the set of arcs under the 2-dimensional Weisfeiler-Leman al-gorithm are in fact the coherent configurations over the vertex set which respect the edgerelation. For an extended background on the theory of coherent configurations, we refer forexample to [Cam03].The 2-dimensional Weisfeiler-Leman algorithm can be used to check whether two given(colored or uncolored) graphs are non-isomorphic by computing the stabilizations and re-jecting if there is a color C such that the numbers of C -colored vertex pairs in the twographs differ. However, even if the stabilizations of the two graphs agree in every numberof vertices for a particular color, the graphs might not be isomorphic. It is not trivial todescribe for which graphs this isomorphism test is always successful (see [KSS15]).In the following, we drop the dimension, i. e., when we talk about the Weisfeiler-Lemanalgorithm or refinement , we always mean the 2-dimensional variant. S. KIEFER AND P. SCHWEITZER An upper bound on the iteration number
Now we prove the upper bound on the number of iterations of the Weisfeiler-Leman algo-rithm. That is, we prove Theorem 1.1 showing that on any colored graph with n vertices,the 2-dimensional Weisfeiler-Leman algorithm terminates after O ( n / log n ) iterations.For this, we are going to define a game in which two players alternate in their turns ona colored graph. We show that the costs of the game form an upper bound on the iterationnumber of the Weisfeiler-Leman algorithm. Therefore, to prove Theorem 1.1 it suffices toshow that the costs of the game, assuming the players play optimally, are O ( n / log n ).The game represents a sequential way of looking at the Weisfeiler-Leman algorithm.Since one turn in the game consists of elementary actions which can be performed one afterthe other and not all at the same time as in one iteration of the Weisfeiler-Leman algorithm,the costs of the game are easier to analyze.3.1. Description of the game.
The game starts with a colored graph on vertex set V .Player 1 begins and the players alternate turns. Each turn consists of choosing a refinementof the current coloring of the graph. If in his turn Player 1 is faced with the coloredgraph G , then he must choose a proper refinement of G , that is, he must return a graph G ′ with G (cid:23) G ′ . In contrast to this, in a turn of Player 2, when faced with the graph G ,she has to return a graph G ′ with G (cid:23) G ′ (cid:23) e G . Thus, the refinement that Player 2chooses must still be coarser than e G , but it can for example be equivalent to G or to e G .The game ends when the coloring of the graph induces the discrete partition, i. e., thepartition {{ ( u, v ) } | u, v ∈ V } .Each turn of Player 1 adds 1 to the total costs of the game, whereas the costs for a turnof Player 2 playing G ′ as a response to G is the smallest integer j such that G ′ (cid:23) G ( j ) . Thus,a turn of Player 2 costs the number of iterations of the Weisfeiler-Leman algorithm that sheneeds to perform in order to obtain a refinement of the graph she returns to Player 1. Inthe game, every modification of a graph that increases the total costs by 1 is called a move .Note that the game has costs of at most O ( n ).Player 1 aims at maximizing the total costs whereas his opponent Player 2 wants tominimize it. Given a strategy S of Player 1 and a strategy S of Player 2, let val( S , S )denote the costs of the game when Player 1 uses S and Player 2 uses S . Since the gameis finite and deterministic and has perfect information, it is not hard to see that the value c ( G ) of the game (i. e., the costs assuming both players play optimally) is well-defined andthat max S min S val( S , S ) = c ( G ) = min S max S val( S , S ) . Note that we can also view the game as a zero-sum game (when considering the costsas the gain for Player 1 and the loss for Player 2).The following lemma states an important monotonicity fact for our game.
Lemma 3.1.
Let G and H be two colored graphs with G (cid:23) H . Then the following hold. (1) G ( i ) (cid:23) H ( i ) for every i . (2) e G (cid:23) e H . (3) If additionally H (cid:23) e G , then for every i with G ( i ) = e G , we have that H ( i ) ≡ e G . Inparticular e H ≡ e G . PPER BOUNDS ON FO-QUANTIFIER DEPTH 7
Proof.
Part 1 follows straight from Definition 2.1 using induction on i : For i = 0, thestatement is the assumption. Suppose that G ( i ) (cid:23) H ( i ) for a fixed i . Let χ G and χ H denote the colorings in G ( i ) and H ( i ) , respectively, and let χ r G and χ r H denote the coloringsin G ( i +1) and H ( i +1) . Let V := V ( G ) = V ( H ). Let ( u , u ) and ( v , v ) be two tupleswith u , u , v , v ∈ V and such that χ r G ( u , u ) = χ r G ( v , v ). We show that χ r H ( u , u ) = χ r H ( v , v ).If χ G ( u , u ) = χ G ( v , v ), the statement follows from G ( i ) (cid:23) H ( i ) and π ( χ H ) (cid:23) π ( χ r H ).Otherwise χ G ( u , u ) = χ G ( v , v ) and therefore, it must hold that (cid:8)(cid:8)(cid:0) χ G ( w, u ) , χ G ( u , w ) (cid:1) (cid:12)(cid:12) w ∈ V (cid:9)(cid:9) = (cid:8)(cid:8)(cid:0) χ G ( w, v ) , χ G ( v , w ) (cid:1) (cid:12)(cid:12) w ∈ V (cid:9)(cid:9) . However, since G ( i ) (cid:23) H ( i ) , the same inequality holds when substituting χ H for χ G .Thus, the tuples χ r H ( u , u ) and χ r H ( v , v ) differ in their second components and hence,they are distinct.Thus, if i is the minimal integer with G ( i ) = e G , then it holds that e G (cid:23) H ( i ) (cid:23) e H , whichproves Part 2. Part 3 is an immediate consequence of Part 1, using that G ( i ) (cid:23) H ( i ) (cid:23) e G .Hence, the game is monotone in the following sense: Given an input graph H , the costsfor Player 2 to obtain the stabilization e H are at most as high as the costs for her to obtainthe stabilization of any other input graph G with G (cid:23) H and e G ≡ e H .We first show that in an optimal strategy, Player 2 does not execute partial iterationsof the Weisfeiler-Leman algorithm on her input. Lemma 3.2.
Suppose that in one of her turns, Player is given a graph G . If she playsoptimally, she returns G ( i ) for some integer i .Proof. Consider a strategy S for Player 2 which dictates to her for at least one input G for her turn to play a graph G ′ such that G ′ G ( j ) for every j . In the game tree T withthis fixed strategy for Player 2, consider a counterexample situation that is maximal withrespect to the number of moves performed so far. That is, consider a node x ∈ V ( T ) atwhich, on input G , Player 2 finishes her turn with a graph G ′ such that G ′ G ( j ) for every j and for which the subtree of T rooted at x contains no such node. Thus, in her future turns,Player 2 always returns a graph corresponding to a full iteration of the Weisfeiler-Lemanalgorithm.Let i be the maximal j with G ( j ) (cid:23) G ′ . Then Player 1 can define G ( i +1) as the newinput for Player 2. By the maximality of the counterexample, Player 2 now finishes thisturn with a graph G ( i + ℓ ) with ℓ ≥
1. This conversion of G into G ( i + ℓ ) contributes thecosts ( i + 1) + 1 + (cid:0) i + ℓ − ( i + 1) (cid:1) = i + ℓ + 1, whereas Player 2 could have reached G ( i + ℓ ) with i + ℓ moves by simply executing the i + ℓ necessary iterations. Thus, the strategy S isnot optimal. Hence, in every optimal strategy Player 2 only returns graphs correspondingto full iterations of the Weisfeiler-Leman algorithm.It is even optimal for Player 2 to return the stabilization of her input. Corollary 3.3.
Given a colored graph G , it is optimal for Player to return e G .Proof. Similarly to the proof of Lemma 3.2, consider the counterexamples in which Player 2is given a graph G and finishes her turn with a graph G ( i ) (cid:23) e G and it would be worsefor her to return e G instead. Take such a counterexample situation that is maximal withrespect to the number of moves performed so far. Given G ( i ) , Player 1 can define G ( i +1) as the new input for Player 2 (including the case that i + 1 = k ). The conversion costs i S. KIEFER AND P. SCHWEITZER for the moves of Player 2 and 1 for Player 1, so altogether i + 1. By the maximality of thecounterexample, from now on, we can assume that Player 2 always returns the stabilizationof her input. If i + 1 = k , that is G ( i +1) = e G , the costs are the same as if Player 2 hadchosen to stabilize G herself. If i + 1 < k , Player 2 now needs k − ( i + 1) additionalmoves to stabilize G ( i +1) , because ^ G ( i +1) = e G by Lemma 3.1. So the conversion costsare i + 1 + (cid:0) k − ( i + 1) (cid:1) = k . That is, in all cases, Player 1 can choose to pursue a strategysuch that the costs are at least as high as when Player 2 always returns stable graphs.To see that the total costs of the game yield an upper bound on the number WL( G ) :=WL ( G ) of iterations of the Weisfeiler-Leman algorithm on input G , it suffices to describe astrategy for Player 1 with which the game has costs at least WL( G ). For this, Player 1 cansimply recolor the arcs according to the first iteration of the Weisfeiler-Leman algorithmand define the graph G (1) as the first input for Player 2. Corollary 3.3 states that it isoptimal for Player 2 to perform the entire Weisfeiler-Leman algorithm on her input. Thus,she could not do better but to perform the remaining iterations of the algorithm on G (1) ,resulting in costs that are at least WL( G ). (They could be higher because the game doesnot end before the discrete partition is reached.)We therefore obtain the following corollary that allows us to analyze the costs of thedescribed game in order to obtain an upper bound on the number of iterations of the 2-dimensional Weisfeiler-Leman algorithm. Corollary 3.4.
Let G be a graph and let c ( G ) be the value of the -player game on input G .Then WL ( G ) ≤ c ( G ) . As a consequence of Corollary 3.3, we can draw conclusions about optimal strategiesfor Player 1.
Lemma 3.5.
If playing G ′ in response to G is optimal for Player then playing G ′′ with G (cid:23) G ′′ (cid:23) G ′ is also optimal for Player .Proof. Given a colored input graph G , a turn of Player 1 consists of choosing a set C ′ ofcolor classes in G which he wants to refine. We denote by G C ′ the graph that Player 1returns to Player 2.We show that it is optimal for Player 1 to refine only one color class per turn. SupposePlayer 1 is given a graph G and decides to refine a set C ′ consisting of ℓ color classes,i. e., C ′ = { C i | ≤ i ≤ ℓ } with ℓ > k be the minimal number with e G C ′ = G ( k ) C ′ . Due to Corollary 3.3, we can assumePlayer 2 always returns the stabilization of her input. Hence, the costs for Player 2 toreturn e G C ′ are k . We show by induction that the costs do not decrease when Player 1 onlyrefines one color class per turn.Suppose Player 1 plays the graph G C , which only refines C . Player 2 will thenstabilize G C with, say, j iterations. That is, she returns e G C = G ( j ) C . From Part 1 ofLemma 3.1, we obtain that e G C (cid:23) G ( j ) C ′ . If j ≥ k , Player 1 can refine e G C to the graph e G C ′ and continue as if e G C ′ was his input graph for this round.Assume therefore that j < k . We know that e G C = G ( j ) C (cid:23) G ( j ) C ′ (cid:23) G ( k ) C ′ = e G C ′ . PPER BOUNDS ON FO-QUANTIFIER DEPTH 9
The second “ (cid:23) ” is proper since j < k and k is minimal. From Part 3 of Lemma 3.1 weknow that the stabilization of G ( j ) C ′ is e G C ′ . This implies that the first “ (cid:23) ” is also properbecause e G C is stable whereas G ( j ) C ′ is not.This shows that e G C is strictly coarser than G ( j ) C ′ . Thus, Player 1 can proceed byrefining e G C to G ( j ) C ′ , on which Player 2 needs k − j moves to obtain the stabilization.In a similar way, one can show that it is optimal for Player 1 to split the selected colorclass only into two color classes.From now on, we can thus assume that Player 1 only refines one color class per turnand that he splits this class into exactly two new color classes. What is the effect of sucha turn of Player 1? By recoloring loops and edges, Player 1 refines vertex color classes andedge color classes. As a consequence, some regularity conditions may no longer hold in theobtained graph G . We are in particular interested in the following two conditions.(C1) The color of an edge determines the color of its head and of its tail. More precisely,for u, v ∈ V ( G ) the color of ( u, v ) determines both the colors of ( u, u ) and ( v, v ).(C2) For every edge color class C and every two vertex color classes C and C , the graphwhich is induced by C between C and C is biregular. By this we mean that for everytwo vertices v , v ∈ C we have | N + C ( v ) ∩ C | = | N + C ( v ) ∩ C | and | N − C ( v ) ∩ C | = | N − C ( v ) ∩ C | and similarly for the C -neighborhoods in C of vertices in C .In her reaction to a turn of Player 1, we let Player 2 “clean up” the graph: By refiningedge color classes, first she reestablishes Condition C1 and after that Condition C2, i. e.,the color-biregularity. We claim that the costs of this procedure only amount to 2. Indeed,to satisfy Condition C1, Player 2 can simply perform one iteration of the Weisfeiler-Lemanalgorithm on her input and ignore various refinements that would be made in this iteration.More precisely, given G colored with χ she can return the coloring that assigns ( u, v ) thecolor (cid:0) χ ( u, v ) , χ ( v, v ) , χ ( u, u ) (cid:1) . Thus, in the first move of her turn, she only refines (real) edge color classes whose heads(and tails, respectively) are not all of the same color. In the second move, she reestablishescolor regularity, i. e., she refines vertex color classes according to their color degrees. Wecall these two moves a clean-up step .It is possible that the attempt to establish Condition C2 causes Condition C1 to beviolated again. Indeed, if the move splits vertex color classes, Condition C1 might needto be reestablished afterwards due to the splitting, i. e., Player 2 might need to continuecleaning-up. In turn this might cause Condition C2 to be violated, and so on. We call ashortest succession of clean-up steps that reestablishes both Condition C1 and Condition C2simultaneously a complete clean-up step . We denote by cclean( G ) the colored graph resultingfrom a complete clean-up step on G .The following observation allows Player 2 to always perform complete clean-up stepswithout causing critical extra costs. Observation 3.6.
There are only O ( n ) splittings of vertex color classes in the game.A clean-up step that is not yet a complete clean-up step consists of at least one splittingof a vertex color class. Therefore, the total costs for a complete clean-up step can be boundedby 2 s + 2 = O ( s ), where s is the number of vertex color class splittings appearing in thecomplete clean-up step. (The additional 2 is for the costs of the last clean-up step, which does not need to incur a vertex color class splitting.) By Observation 3.6, there are only O ( n )vertex color class splittings in the whole game and each of them appears in at most onecomplete clean-up step. We obtain the following bound on the costs for clean-up steps thatsplit vertex color classes. Corollary 3.7.
The total costs for complete clean-up steps that split vertex color classesamount to O ( n ) . A complete clean-up step in which no vertex color classes are split consists only of oneclean-up step. Therefore, such a complete clean-up step has constant costs of at most 2.This means that we can assign these costs to the preceding move (either performed byPlayer 1 or Player 2) since every move entails at most one complete clean-up step. Thus,the extra costs for complete clean-up steps do not have an effect on the asymptotic boundthat we want to obtain for the costs of the game.Now we know optimal strategies for both players and we have seen that Player 2 canperform complete clean-up steps whenever she wants without asymptotically increasing thecosts. We can thus assume that Player 2 always performs a complete clean-up step on herinput graph before and after manipulating it.3.2.
Large color classes.
To give a bound on the costs of the game, we distinguish betweenlarge vertex color classes and small vertex color classes with respect to some thresholdfunction t .Let t : N → N be a function with t ( n ) > n . We call a vertex color class of G large with respect to t if it consists of at least t ( n ) = t ( | V | ) vertices. A small vertex colorclass is one that is not large.The choice of the threshold function t for our purposes will be a tradeoff between thecosts for operations on edges incident with large vertex color classes and edges incident withsmall vertex color classes. We will later see that setting t ( n ) := log ( n ) / χ , we define a potential function by setting f ( χ ) := X v ∈ V |{ χ ( v, w ) | w ∈ V }| . Obviously, f ( χ ) ≤ n for all colorings χ and f is strictly monotonically increasing. That is,if π ( χ ) (cid:23) π ( χ ′ ) then f ( χ ) < f ( χ ′ ).Let B , B , . . . be an enumeration of the large vertex color classes and let B := ˙ S k B k be the set of vertices in large vertex color classes. Lemma 3.8.
Suppose that the current coloring in the game is χ and that the current playerchooses a refinement which for some v ∈ B induces a strictly finer partition on { ( v, w ) | w ∈ V } than χ . If a subsequent complete clean-up step does not split any large vertex colorclass, then f increases by at least t ( n ) .Proof. Let v be as in the assumptions of the lemma and let B k be the large vertex colorclass that contains v . Denote by χ ′ the coloring obtained after a subsequent clean-up step.Then in particular there is a certain, not necessarily large, vertex color class C such that PPER BOUNDS ON FO-QUANTIFIER DEPTH 11 on the set { ( v, w ) | w ∈ C } , the coloring χ ′ induces a strictly finer partition than χ . Thus,the number of color classes occurring in the set { ( v, w ) | w ∈ C } increases by at least 1.By assumption, the vertex color class B k is not split in this round and we can assumePlayer 2 always performs complete clean-up steps. Therefore, to ensure all vertices in B k have identical color degrees (Condition 2), also on every set { ( v ′ , w ) | w ∈ C } with v ′ ∈ B k ,the coloring χ ′ must induce a partition strictly finer than the one induced by χ . Hence, foreach of these sets, of which there are at least t ( n ), the number of occurring color classesincreases by at least 1.For any vertex v ∈ V and any vertex set V ′ , we have |{ χ ′ ( v, w ) | w ∈ V ′ }| ≥ |{ χ ( v, w ) | w ∈ V ′ }| and so f ( χ ′ ) = X v ∈ V |{ χ ′ ( v, w ) | w ∈ V }| = X v ∈ B k |{ χ ′ ( v, w ) | w ∈ V }| + X v ∈ V \ B k |{ χ ′ ( v, w ) | w ∈ V }| C1 = X v ∈ B k |{ χ ′ ( v, w ) | w ∈ C }| + X v ∈ B k |{ χ ′ ( v, w ) | w ∈ V \ C }| + X v ∈ V \ B k |{ χ ′ ( v, w ) | w ∈ V }|≥ X v ∈ B k |{ χ ( v, w ) | w ∈ C }| + t ( n ) + X v ∈ B k |{ χ ( v, w ) | w ∈ V \ C }| + X v ∈ V \ B k |{ χ ( v, w ) | w ∈ V }|≥ t ( n ) + f ( χ )and this gives the claim. Corollary 3.9.
The costs for the moves (and the following complete clean-up steps) inwhich the color set of edges incident with large vertex color classes is properly refinedare O (cid:0) n /t ( n ) (cid:1) . This bound already includes the necessary complete clean-up steps. In the following,we treat the moves in which edge color classes that are only incident with small vertex colorclasses are refined.3.3.
Small color classes.
To analyze the costs for small vertex color classes, we describe astrategy for Player 2 on them. For this, we define auxiliary graphs which she uses to derivemoves in the original game. For a colored graph G from the original game, its auxiliarygraph is denoted by Aux( G ). Just like with the clean-up steps in the original game, Player 2will pursue a strategy according to information obtained from auxiliary graphs in order tomaintain certain invariants. Notation 3.10.
We describe all graphs coming from the original game using the letter G and all auxiliary graphs using the letter H or, when derived from a specific graph G ,by Aux( G ), in order to distinguish between them more clearly. Every auxiliary graph is undirected, simple, uncolored and not necessarily complete.For the sake of readability, we consider the edge set of an auxiliary graph H with vertexset V ( H ) to just be a subset of {{ u, v } | u, v ∈ V ( H ) , u = v } and we drop the notion of acoloring for auxiliary graphs. Whereas in the original game, a move recolors edges, in theauxiliary graphs edges are inserted .Next we describe how to obtain the auxiliary graph for a graph G appearing during a runof the game. The auxiliary graph Aux( G ) is constructed as follows: Let G , G , G , . . . , G ℓ = G be the graphs that were played by the players so far. Let T be the collection of vertexsets C ⊆ V ( G ) that each form a small vertex color class in some G i .The vertices of the auxiliary graph Aux( G ) form a partition into two sets called the upper and the lower vertices ( V u and V ℓ , respectively). They are two identical copies of theset defined as (cid:8) ( C, M ) | C ∈ T , M ⊆ C (cid:9) , that is, the set that contains all pairs of a small vertex color class C that has appeared sofar in the game and a subset of C . Thus, as the game progresses the auxiliary graphs havemore and more vertices.For every small vertex color class C ∈ T , the graph Aux( G ) contains 2 | C | upper verticesand also 2 | C | lower vertices. Thus, there are at most 4 n · t ( n ) vertices in Aux( G ). (To seethis, one observes that there are at most 2 n elements in T .) We have an undirected edgebetween an upper vertex ( C, M ) ∈ V u and a lower vertex ( D, N ) ∈ V ℓ if there exists a setof colors C ′ ⊆ C such that in G , every vertex v ∈ C satisfies v ∈ M ⇐⇒ N + C ′ ( v ) = N. This means that all the edges between M and N in G have a color contained in C ′ .Another way of formulating this is that the vertices of M are exactly the ones whose C ′ -neighborhood is N .Between two upper vertices ( C, M ) and ( C ′ , M ′ ), we insert an undirected edge if sucha condition holds in both directions—more precisely, if there are sets of colors C ′ , C ′′ ⊆ C such that every vertex v ∈ C ′ satisfies v ∈ M ⇐⇒ N + C ′ ( v ) = M ′ , and every vertex v ∈ C ′′ satisfies v ∈ M ′ ⇐⇒ N + C ′′ ( v ) = M. The resulting graph is the auxiliary graph Aux( G ). Remark 3.11.
Let G and G ′ with G (cid:23) G ′ be two graphs appearing during the originalgame (i. e., the graph G ′ appears later than G ). Then it holds that Aux( G ′ ) ⊇ Aux( G ), sinceby definition, the graph Aux( G ′ ) contains all the vertices and all the edges from previousauxiliary graphs.To describe the strategy that Player 2 will pursue in the original game, we need the no-tion of a triangle completion , an operation on undirected uncolored graphs, which we definenext. Whereas the clean-up steps are designed to simulate information essentially collectedby the 1-dimensional Weisfeiler-Leman algorithm, the triangle completion is designed tocapture certain dynamics of the 2-dimensional algorithm, as will become apparent.For an undirected uncolored graph H with V ( H ) = V u ˙ ∪ V ℓ , its triangle completion △ ( H )is obtained by applying the following rules once. PPER BOUNDS ON FO-QUANTIFIER DEPTH 13 • Insert an edge between every two upper vertices that have a common neighbor in V ℓ orin V u . • Insert an edge between every upper vertex and every lower vertex that have a commonneighbor in V u .Note that no edges between vertices in V ℓ are inserted. On the obtained graph △ ( H ),new applications of the above rules may be possible. The graph obtained after i repetitionsof the triangle completion on H is denoted by △ i ( H ). We call H stable if △ ( H ) = H . Remark 3.12.
An undirected uncolored graph H with V ( H ) = V u ˙ ∪ V ℓ is stable if andonly if every connected component of H has the following properties: • The graph induced on V u is a clique. • The graph induced by the edges between V u and V ℓ is complete bipartite.Now we describe the strategy that Player 2 derives from the auxiliary graphs for theoriginal game. It is also shown in Algorithm 1. Player 2 first performs a complete clean-up step on her input graph. Then as long as the auxiliary graph of her obtained graphis not stable, she iterates the following process on it: First she performs an iteration ofthe Weisfeiler-Leman algorithm on G , then a complete clean-up step. She returns the firstcompletely cleaned-up graph G ′ for which Aux( G ′ ) is stable to Player 1 who then performshis next turn. Algorithm 1
One turn of Player 2 in the 2-player game on input G . Input:
A colored graph G . Output:
A refinement G ′ of G satisfying G (cid:23) G ′ (cid:23) e G . G ← cclean( G ) while △ (cid:0) Aux( G ) (cid:1) = Aux( G ) do G ← G (1) G ← cclean( G ) end while return G We claim that if Player 2 follows this strategy, then she only computes O ( n · t ( n ) )pairwise different auxiliary graphs. To show this, we need the following lemma. Lemma 3.13.
Let H , . . . , H k be a sequence of graphs such that for all i , the followinghold. • V ( H i ) = V iℓ ˙ ∪ V iu . • | V iℓ | = | V iu | ≤ m for some m . • V i +1 ℓ ⊇ V iℓ and V i +1 u ⊇ V iu . • △ ( H i ) ⊆ H i +1 . • H i = H i +1 .Furthermore assume that the graph induced by each V iℓ is empty. Then k ∈ O ( m ) .Proof. Without loss of generality assume | V iℓ | = m for every i . Thus, we may assumethat the vertices of all the H i are the same set V u ˙ ∪ V ℓ . For a fixed k , let H , H , . . . , H k be a minimal counterexample to the statement of the lemma, i. e., choose the graphs H i to have as few edges as possible. This implies that for the cases that △ ( H i ) = H i we have H i +1 = △ ( H i ) and for every other i we have | E ( H i +1 ) \ E ( H i ) | = 1. We may assumethat H is empty.We claim that for any j with △ ( H j ) = H j , there is some r ≤ △ ( H j + r ) = H j + r , i. e., the graph H j + r is stable again.Suppose △ ( H j ) = H j , that is, H j is stable and has the structure described in Re-mark 3.12. If H j +1 = △ ( H j +1 ), the claim is true. Thus assume H j +1 = △ ( H j +1 ). Re-member that by the minimality of our counterexample, we have H i +1 = △ ( H i ). By thedefinition of the triangle completion, the new edge e in H j +1 either connects two upper ver-tices or an upper and a lower vertex. Suppose first that e = { v, v ′ } with v, v ′ ∈ V u . Let U ( v )and U ( v ′ ) be the cliques containing v and v ′ among V u , respectively, and let L ( v ) and L ( v ′ )be the vertices in V ℓ that are connected to U ( v ) and U ( v ′ ), respectively. In △ ( H j +1 ), theedges between v and U ( v ′ ) and between v ′ and U ( v ) are inserted, as well as the edges be-tween L ( v ) and v ′ and between L ( v ′ ) and v . In △ ( H j +1 ), the graph induced by U ( v ) ˙ ∪ U ( v ′ )is rendered a clique and all edges between L ( v ) and U ( v ′ ) and between L ( v ′ ) and U ( v ) areinserted, resulting in a connected component that is complete bipartite between its upperand its lower vertices.Suppose now that e = { v, v ′ } with v ∈ V u and v ′ ∈ V ℓ . If v ′ is not adjacent to any uppervertex, then in △ ( H j +1 ) all edges between v ′ and U ( v ) are inserted and △ ( H j +1 ) is stable.Otherwise, let U ( v ′ ) be the clique among V u that is connected to v ′ . Similarly as in the casethat e is an edge among upper vertices, in △ ( H j +1 ), the graph induced by U ( v ) ˙ ∪ U ( v ′ ) is aclique and all edges between L ( v ) and U ( v ′ ) are present. The vertices in L ( v ′ ) are adjacentto all vertices in U ( v ′ ) and to v . A third triangle completion then accounts for the missingedges between L ( v ′ ) and U ( v ).Therefore, the gap between two successive stable graphs is at most 4.For every i such that H i is stable, the graph H i +1 contains an edge that connects twoconnected components from H i . We know that H is stable and we have shown that thegap between stable graphs is at most 4. Thus, also the gap between the graphs H i +1 thatcontain an extra edge connecting two connected components from H i is at most 4. Thereare at most 2 m isolated vertices in H , which yields k ≤ · m = O ( m ). Lemma 3.14.
Let G be a graph that is completely cleaned up (i. e., G satisfies cclean( G ) = G ). Then Aux( G (1) ) ⊇ △ (cid:0) Aux( G ) (cid:1) .Proof. Suppose G satisfies the assumption. Let V u ˙ ∪ V ℓ be the partition of the verticesof Aux( G ) into upper and lower vertices. Let ( C , M ) and ( C , M ) be two vertices of V u both adjacent to the vertex ( D, N ) ∈ V ℓ . We prove that ( C , M ) and ( C , M ) are adjacentin Aux( G (1) ).By definition of the auxiliary graph, there exists a set of colors C ⊆ C such that in G ,every vertex v ∈ C satisfies v ∈ M ⇐⇒ N + C ( v ) = N. There is also a set C ⊆ C such that in G , every vertex v ∈ C satisfies v ∈ M ⇐⇒ N −C ( v ) = N. Here, we use the fact that edge colorings respect converse equivalence.For m ∈ M we have that m ′ ∈ M if and only if for every vertex w ∈ D it holds that χ ( m, w ) ∈ C ⇐⇒ χ ( w, m ′ ) ∈ C . PPER BOUNDS ON FO-QUANTIFIER DEPTH 15
Since G is completely cleaned up, this does not only hold for every w ∈ D but for every w ∈ V ( G ). This implies that in G (1) there is a set of colors C ′ such that every vertex v ∈ C satisfies v ∈ M ⇐⇒ N + C ′ ( v ) = M . To see this, suppose v ∈ M . The new color of an edge ( v , v ) contains in its secondcomponent the multiset consisting of the tuples (cid:0) χ ( w, v ) , χ ( v , w ) (cid:1) with w ∈ V ( G ).For v ∈ M we have (cid:0) χ ( w, v ) , χ ( v , w ) (cid:1) ∈ ( C × C if w ∈ N ( C\C ) × ( C\C ) if w / ∈ N. However, if v ∈ M and v ∈ ( C \ M ), then the multiset in the new color of theedge ( v , v ) will contain some element from (cid:0) ( C\C ) × C (cid:1) ∪ (cid:0) C × ( C\C ) (cid:1) .Note that if v / ∈ C , then the new color of ( v , v ) is different from all colors of edgesbetween C and C anyway since G is completely cleaned up. Thus, we obtain that in G (1) the colors of edges from M to M are distinct from the colors of edges from M to thecomplement of M .By symmetry this shows that in Aux( G (1) ) the vertices ( C , M ) and ( C , M ) areadjacent.A similar argument shows that if ( C , M ) is adjacent to ( C , M ) and an upper orlower vertex ( D, N ), then in Aux( G (1) ) there is an edge between ( C , M ) and ( D, N ).We conclude that Aux( G (1) ) ⊇ △ (cid:0) Aux( G ) (cid:1) .After each complete clean-up step that Player 2 performs in the original game, shecomputes an auxiliary graph. We show that two auxiliary graphs differ by at least one edgeif between their computations, in the original game at least one (vertex or edge) color classwhich is only incident with small vertex color classes is refined—either by a move of Player 1or during the subsequent complete clean-up step performed by Player 2. Lemma 3.15.
Let
G, G ′ with G (cid:23) G ′ be two graphs appearing in the game that have beencompletely cleaned up. If there is a color class in G that has been refined in G ′ and is onlyincident with small vertex color classes, then it holds that Aux( G ) $ Aux( G ′ ) .Proof. Suppose after a complete clean-up step, a small vertex color class of G has beensplit into at least two new small vertex color classes C ′ and C ′′ in G ′ . Thus, becauseof Condition C1 of a completely cleaned-up graph, the graph Aux( G ′ ) contains an edgebetween the upper and the lower copy of ( C ′ , C ′ ), whereas none of these two vertices ispresent in Aux( G ).Now suppose that after a complete clean-up step, an edge color class C of G onlyincident with small vertex color classes has been split in G ′ into at least two new edge colorclasses C ′ and C ′′ without causing any splitting of small vertex color classes. Consequently,there exists a vertex v in a small vertex color class A of G ′ which satisfies that ∅ $ N + C ′ ( v ) $ N + C ( v ). Now we define M := { u ∈ A | N + C ′ ( u ) = N + C ′ ( v ) } . Let N be the vertex color classin G containing N + C ′ ( v ). The edge (cid:8) ( A, M ) , (cid:0) N, N + C ′ ( v ) (cid:1)(cid:9) is present in Aux( G ′ ) but notin Aux( G ).We wish to bound the costs that Player 2 incurs within Algorithm 1. To do so weneed to bound the costs that incur before and within the while loop. Let G , G , . . . be thesequence containing the following two types of graphs in their order of appearance during the game. On the one hand, it contains the graphs that are played by Player 1 and cleanedup by Player 2 and have incurred some refinement of edges only incident with small vertexcolor classes. On the other hand, it contains the graphs that are results of computationsof Line 4 of Algorithm 1 across the entire play of the game. Thus, the sequence consists ofall completely cleaned-up graphs which are played in the game right after a refinement ofcolor classes that are only incident with small vertex color classes. Lemma 3.16.
The sequence of graphs G , G , . . . has length at most O (2 t ( n ) n ) .Proof. We set m := 4 n · t ( n ) for the threshold function t . Each of Aux( G ) , Aux( G ) , . . . hassize at most m . Thus, since G i +1 (cid:22) G i , it holds that Aux( G i ) ⊆ Aux( G i +1 ) by Remark 3.11.The while loop in Algorithm 1 is only entered in the case that △ (cid:0) Aux( G ) (cid:1) = Aux( G ). Alsoin that situation the graph G is completely cleaned up. We conclude with Lemma 3.14that △ (cid:0) Aux( G i ) (cid:1) ⊆ Aux( G i +1 ). With Lemma 3.15 we obtain that Aux( G i ) $ Aux( G i +1 ).Therefore, the sequence of the auxiliary graphs Aux( G ) , Aux( G ) , . . . fulfills the condi-tions of Lemma 3.13 with m = O (2 t ( n ) n ), implying that the length of the sequence G , G . . . is O ( m ) = O (2 t ( n ) n ).The lemma in particular implies that Algorithm 1 terminates. Now we can bound theiteration number for small color classes. Corollary 3.17.
The number of iterations in which color classes that are only incidentwith small vertex color classes are refined is O (2 t ( n ) n ) .Proof. By Lemma 3.16, the sequence of the computed auxiliary graphs satisfies the condi-tions from Lemma 3.13. Thus, every subsequence of it also satisfies these conditions. Ifwe only consider the subsequence of auxiliary graphs that are computed after moves thatrefine a color class which is only incident with small vertex color classes, we know thatthe sequence has length O ( m ), where m is the maximum number of upper vertices in anauxiliary graph. Thus, the sequence has length O ( n · t ( n ) ).With Lemma 3.15, the length of the sequence is an upper bound on the number ofiterations in which color classes that are only incident with small vertex color classes arerefined.From the corollary we immediately conclude Lemma 1.3.We have assembled all the required tools to prove our main theorem concerning theupper bound on the number of iterations. Proof of Theorem 1.1.
Let G be a graph with n vertices. To show a bound on the numberof iterations it suffices to show an upper bound on the costs of the 2-player game thatwe defined. Assume that both players play optimally. By Corollary 3.9 the total costs ofmoves in which a color class incident with a large vertex color class is split is O (cid:0) n /t ( n ) (cid:1) .By Corollary 3.17, the total costs of moves in which a small color class is split are O ( n · t ( n ) ).Therefore, the entire game costs O (cid:0) n /t ( n ) (cid:1) + O ( n · t ( n ) ) and setting t := log ( n ) / O (cid:0) n / log ( n ) (cid:1) . PPER BOUNDS ON FO-QUANTIFIER DEPTH 17 Logics without counting
The bound we have proven for the 2-dimensional Weisfeiler-Leman algorithm leads tobounds on the quantifier depth in the 3-variable fragment of first-order logic with count-ing C . However, one may wonder what happens for the 3-variable fragment of first-orderlogic without counting L . A priori it is not clear that there should be a relationship be-tween the depths of formulas distinguishing graphs in C and in L . We can thus not drawconclusions about L from our theorems.However, a careful analysis of our proof reveals that we could have obtained the sameresults for the logic without counting.For this, one has to redefine the coloring in Definition 2.1 so as to obtain a non-countingversion of the 2-dimensional Weisfeiler-Leman algorithm (see [Ott17, Subsection 2.2.4]). Inthis version we replace the multiset M with a set with the same elements. Refinementand stability is then defined with respect to this new operator. Most lemmas apply to thenew situation with verbatim proofs. Most notably for the potential function for large colorclasses, the definition does not use a multiset.Condition C2 in the clean-up steps of Player 2 then has to be replaced by a conditionwhich requires that for v , v ∈ C we have that { χ ( v , u ) | u ∈ C } = { χ ( v , u ) | u ∈ C } and also { χ ( u, v ) | u ∈ C } = { χ ( u, v ) | u ∈ C } .Finally we highlight the fact that in the auxiliary graph, the definition of adjacencydoes not require counting either. For example, the existence of a set of colors C ′ ⊆ C suchthat every vertex v satisfies v ∈ M ⇐⇒ N + C ′ ( v ) = N, can obviously be expressed in a C -formula without counting quantifiers. We conclude thatanalogous statements to our theorems also hold for the 3-variable first-order logic withoutcounting L . 5. Conclusion
We have shown that the number of iterations of the 2-dimensional Weisfeiler-Leman algo-rithm is in O (cid:0) n / log( n ) (cid:1) .The factor 1 / log( n ) arises from a trade-off between considerations in large and smallvertex color classes, and thus it arises from the factor of 2 t appearing in Lemma 1.3. However,an improvement of the bound on the iteration number for graphs with bounded color classsize would not directly improve the overall iteration number. Indeed, since refinementswithin small color classes may be caused by refinements of large color classes, and also sincesmall color classes might appear only over time, we crucially needed to bound the numberof all refinements involving small color classes within general graphs (that may not havebounded color class size). This is exactly what our game is suitable for, since Player 1 maycontinue to refine the graph after it is stable.Our proof for the 3-variable logic already requires a careful analysis of the interactionbetween the small color classes. However, it remains an interesting open question whetherour techniques can be generalized to also show bounds on the depth of formulas with morevariables. Appendix A. Converse equivalence
In this section we briefly discuss the quite technical reason why we require converse equiva-lence for all colorings. Indeed we required that χ ( v , u ) = χ ( v , u ) if and only if χ ( u , v ) = χ ( u , v ) for any coloring χ that we consider (see the preliminaries). In principle it wouldbe possible to avoid such a definition. However, consider the following example. Let A := { a , a , . . . , a t } and B := { b , b , . . . , b t } be two sets of equal size. We define a coloring χ such that for all a, a ′ ∈ A and b, b ′ ∈ B with a = a ′ and b = b ′ we have that χ ( a, a ) = χ ( b, b ) = 0, χ ( a, a ′ ) = 1, χ ( b, b ′ ) = 2, χ ( b, a ) = 3. We also define χ ( a i , b j ) = 4 if i = j or i = j + 1 modulo t and define χ ( a i , b j ) = 5 otherwise. Note that this coloring does nothave the converse equivalence property. If we apply the definition of the Weisfeiler-Lemanalgorithm given in Definition 2.1, then this coloring is stable. For such a coloring one has toadapt the multiset M to also take reverse directions into account and replace the definitionby M := (cid:8)(cid:8)(cid:0) χ ( w, v ) , χ ( v , w ) , χ ( v , w ) , χ ( w, v ) (cid:1) | w ∈ V (cid:9)(cid:9) . In the logic context, especially when working with finite structure this is the natural defini-tion for the Weisfeiler-Leman algorithm (see for example [KSS15]). Also in the context ofcoherent configurations this is always required [Cam03]. Since the definition ensures that aniteration of the Weisfeiler-Leman algorithm can also take reverse directions into account, af-ter one iteration the coloring satisfies converse equivalence. (Recall that loops have differentcolors than other edges.) Converse equivalence is then maintained in all future iterationsas well.In the game we consider in this paper, we basically want to allow Player 1 to refineto arbitrary colorings that do not arise from the application of the algorithm. Indeed,we can drop the requirement for converse equivalence. In this case, at the expense of amore technical clean-up procedure Player 2 could then (under the new definition of theWeisfeiler-Leman algorithm) restore converse equivalence. Overall we obtain essentially thesame results.
References [Bab95] L´aszl´o Babai.
Handbook of Combinatorics (vol. 2) , chapter Automorphism groups, isomorphism,reconstruction, pages 1447–1540. MIT Press, Cambridge, MA, USA, 1995.[Bab16] L´aszl´o Babai. Graph isomorphism in quasipolynomial time [extended abstract]. In
Proceedings ofthe 48th Annual ACM SIGACT Symposium on Theory of Computing, STOC 2016, Cambridge,MA, USA, June 18-21, 2016 , pages 684–697, 2016.[BBG13] Christoph Berkholz, Paul S. Bonsma, and Martin Grohe. Tight lower and upper bounds for thecomplexity of canonical colour refinement. In
Algorithms - ESA 2013 - 21st Annual EuropeanSymposium, Sophia Antipolis, France, September 2-4, 2013. Proceedings , volume 8125 of
LectureNotes in Computer Science , pages 145–156. Springer, 2013.[BCKP10] Luitpold Babel, Irina V. Chuvaeva, Mikhail Klin, and Dmitrii Pasechnik. Algebraic combina-torics in mathematical chemistry. Methods and algorithms, II. Program implementation of theWeisfeiler-Leman algorithm. 2010.[Ber14] Christoph Berkholz. The propagation depth of local consistency. In
Principles and Practice ofConstraint Programming - 20th International Conference, CP 2014, Lyon, France, September8-12, 2014. Proceedings , pages 158–173, 2014.[BES80] L´aszl´o Babai, Paul Erd˝os, and Stanley M. Selkow. Random graph isomorphism.
SIAM Journalon Computing , 9(3):628–635, 1980.[Bl¨a13] Markus Bl¨aser. Fast matrix multiplication.
Theory of Computing, Graduate Surveys , 5:1–60,2013.
PPER BOUNDS ON FO-QUANTIFIER DEPTH 19 [BN16] Christoph Berkholz and Jakob Nordstr¨om. Near-optimal lower bounds on quantifier depth andWeisfeiler-Leman refinement steps. In
Proceedings of the 31st Annual ACM/IEEE Symposiumon Logic in Computer Science, LICS ’16, New York, NY, USA, July 5-8, 2016 , pages 267–276,2016.[Cam03] Peter J. Cameron. Coherent configurations, association schemes and permutation groups. In
Groups, combinatorics & geometry (Durham, 2001) , pages 55–71. World Sci. Publ., River Edge,NJ, 2003.[CFI92] Jin-Yi Cai, Martin F¨urer, and Neil Immerman. An optimal lower bound on the number ofvariables for graph identification.
Combinatorica , 12(4):389–410, 1992.[DLSM04] Paul T. Darga, Mark H. Liffiton, Karem A. Sakallah, and Igor L. Markov. Exploiting structurein symmetry detection for CNF. In
Proceedings of the 41th Design Automation Conference, DAC2004, San Diego, CA, USA, June 7-11, 2004 , pages 530–534. ACM, 2004.[F¨ur01] Martin F¨urer. Weisfeiler-Lehman refinement requires at least a linear number of iterations. In
Automata, Languages and Programming, 28th International Colloquium, ICALP 2001, Crete,Greece, July 8-12, 2001, Proceedings , volume 2076 of
Lecture Notes in Computer Science , pages322–333. Springer, 2001.[GKMS14] Martin Grohe, Kristian Kersting, Martin Mladenov, and Erkal Selman. Dimension reductionvia colour refinement. In
Algorithms - ESA 2014 - 22th Annual European Symposium, Wroclaw,Poland, September 8-10, 2014. Proceedings , volume 8737 of
Lecture Notes in Computer Science ,pages 505–516. Springer, 2014.[Gro12] Martin Grohe. Fixed-point definability and polynomial time on graphs with excluded minors.
J.ACM , 59(5):27, 2012.[IL90] Neil Immerman and Eric Lander. Describing graphs: A first-order approach to graph canoniza-tion. In
Complexity Theory Retrospective , pages 59–81. Springer New York, 1990.[JK07] Tommi A. Junttila and Petteri Kaski. Engineering an efficient canonical labeling tool for large andsparse graphs. In
Proceedings of the Nine Workshop on Algorithm Engineering and Experiments,ALENEX 2007, New Orleans, Louisiana, USA, January 6, 2007 . SIAM, 2007.[KSS15] Sandra Kiefer, Pascal Schweitzer, and Erkal Selman. Graphs identified by logics with counting.In
Mathematical Foundations of Computer Science 2015 - 40th International Symposium, MFCS2015, Milan, Italy, August 24-28, 2015, Proceedings, Part I , volume 9234 of
Lecture Notes inComputer Science , pages 319–330. Springer, 2015.[Kuc87] Ludek Kucera. Canonical labeling of regular graphs in linear average time. In ,pages 271–279. IEEE Computer Society, 1987.[KV08] Johannes K¨obler and Oleg Verbitsky. From invariants to canonization in parallel. In
ComputerScience - Theory and Applications, Third International Computer Science Symposium in Russia,CSR 2008, Moscow, Russia, June 7-12, 2008, Proceedings , volume 5010 of
Lecture Notes inComputer Science , pages 216–227. Springer, 2008.[KV15] Andreas Krebs and Oleg Verbitsky. Universal covers, color refinement, and two-variable countinglogic: Lower bounds for the depth. In , pages 689–700. IEEE, 2015.[LSS +
16] Wenchao Li, Hossein Saidi, Huascar Sanchez, Martin Sch¨af, and Pascal Schweitzer. Detectingsimilar programs via the Weisfeiler-Leman graph kernel. In
Software Reuse: Bridging with Social-Awareness - 15th International Conference, ICSR 2016, Limassol, Cyprus, June 5-7, 2016, Pro-ceedings , pages 315–330, 2016.[MP14] Brendan D. McKay and Adolfo Piperno. Practical graph isomorphism, II.
J. Symb. Comput. ,60:94–112, 2014.[Ott17] Martin Otto.
Bounded Variable Logics and Counting: A Study in Finite Models , volume 9 of
Lecture Notes in Logic . Cambridge University Press, 2017.[PV11] Oleg Pikhurko and Oleg Verbitsky. Logical complexity of graphs: a survey. In
Model theoreticmethods in finite combinatorics , volume 558 of
Contemp. Math. , pages 129–179. Amer. Math.Soc., Providence, RI, 2011.[Sch09] Pascal Schweitzer.
Problems of unknown complexity : graph isomorphism and Ramsey theoreticnumbers . PhD thesis, Universit¨at des Saarlandes, Saarbr¨ucken, 2009. [SSvL +
11] Nino Shervashidze, Pascal Schweitzer, Erik Jan van Leeuwen, Kurt Mehlhorn, and Karsten M.Borgwardt. Weisfeiler-Lehman graph kernels.
Journal of Machine Learning Research , 12:2539–2561, 2011.
This work is licensed under the Creative Commons Attribution License. To view a copy of thislicense, visit https://creativecommons.org/licenses/by/4.0/https://creativecommons.org/licenses/by/4.0/