Canonical Labelling of Random Regular Graphs
Abstract
We prove that whenever and as , then with high probability for any non-trivial initial colouring, the colour refinement algorithm distinguishes all vertices of the random regular graph . This, in particular, implies that with high probability admits a canonical labelling computable in time , where is the matrix multiplication exponent.
Keywords and phrases:
random graphs, regular graphs, colour refinement, canonical labelling, graph isomorphismCategory:
Track A: Algorithms, Complexity and GamesFunding:
Brendan D. McKay: Supported by Australian Research Council grant DP190100977.Copyright and License:
Maksim Zhukovskii; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Mathematics of computing Random graphs ; Mathematics of computing Graph algorithmsEditors:
Sayan Bhattacharya, Danupon Nanongkai, Michael Benedikt, and Gabriele PuppisSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik
1 Introduction
Given an input graph , a canonical labelling algorithm computes a bijection with the following property: if a graph is isomorphic to , then the relabelled versions of and , under the actions of and , are identical. There is a linear time reduction from the graph isomorphism problem to canonical labelling: once the labellings have been computed for two input graphs , it takes time to check whether are isomorphic. The best known (in the worst case) algorithm for the graph isomorphism problem is due to Babai [6, 27]: it runs in time for -vertex graphs. A quasi-polynomial bound is also known for the canonical labelling problem [7]. Nevertheless, for graphs with bounded degree, both problems can be solved in polynomial time [9, 40]. In particular, this is the case for -regular graphs when In this paper, we show that there exists a polynomial-time canonical labelling algorithm for almost all -regular graphs for all .
Colour refinement (CR) is a simple algorithmic routine that operates on vertex-coloured graphs. For an input graph with initial colouring , CR iteratively computes new colourings. At round , is a pair , where is the multiset of -colours of neighbours of . That is, the process refines the initial partition and halts once the partition stabilises. Let us call a colouring discrete if every pair of vertices is coloured differently. If CR runs on an uncoloured graph (i.e., there is only one initial colour) and outputs a discrete colouring, then, since the vertex colours are isomorphism-invariant, this yields a canonical labelling by numbering the colour names in the lexicographic order. In [8, 18, 25], it was proved that CR run on a binomial random graph 111The vertex set of is , and each pair of vertices is adjacent with probability , independently of the other pairs. outputs a discrete colouring with high probability (whp, in what follows)222A sequence of events holds with high probability if as . whenever , which implies a near linear time algorithm for canonical labelling of [12].
We stress that for regular uncoloured graphs , CR terminates immediately with a trivial colouring, and is therefore unsuitable for canonical labelling. For a positive integer , we denote . Let be a non-negative integer such that is even. Let be a uniform distribution over all -regular graphs on . We write for a graph sampled from this distribution, i.e. is a uniformly random -regular graph on . Since, for constant , efficient canonical labelling algorithms are known, we focus on the case . Moreover, since the edge complement of a -regular graph is -regular, the edge complement of is distributed as . Therefore, we may restrict ourselves to . Our main result shows that the triviality of the initial colouring is the only obstacle for a complete refinement: once a non-trivial initial colouring is produced, whp CR run on outputs a discrete colouring which is suitable for canonical labelling.
Before we state the main result of this paper, we need one more definition. For a connected graph , we denote by its diameter.
Theorem 1.
Let be large enough, let be such that , and let . Then, the following holds whp: for every non-trivial partition of the vertex set of , CR runs at most steps on and outputs a discrete colouring.
We note that we did not try to optimise the bound on the number of rounds, and we believe that is suboptimal. In particular, for , we show that rounds is enough. Actually, it is natural to suspect that the total number of rounds needed is whp.
We now describe a possible approach to canonical labelling of based on our main result. Since the output of CR can be computed in time on an -vertex graph [12], Theorem 1 reduces the problem to efficiently finding an isomorphism-preserving partition of . To this end, recall that, for any , whp contains a triangle [32]. Let be the number of triangles that contain the vertex in , and let Using fast square matrix multiplication, it is possible to compute the vector in time , where [1]. Alternatively, this vector can be computed in time using the standard triangle-listing algorithm [16], which is faster when , assuming the best known upper bound on the matrix multiplication exponent (and yields the bound for , which is faster than any algorithm based on square matrix multiplication since ). Then, we can partition into sets where contains all vertices for which and contains the rest.
Since whp contains a triangle, is non-empty. When , the number of triangles is sublinear whp (by Claim 9 below), which immediately implies that there are vertices that do not belong to a triangle, and so the set is non-empty as well. In order to show that is non-empty (i.e., that there are two vertices with ) whp when , fix two vertices and expose their neighbourhoods . Then expose the edges inside . Assuming , the set of exposed edges identifies the number of edges that have both endpoints in but not in (that is, in ). By standard counting arguments (or using switchings), it follows directly that, for any fixed , the probability that the latter set contains exactly edges tends to zero. Finally, when , it is known that the number of triangles in satisfies a central limit theorem: converges in distribution to a standard normal random variable as [21]. In particular, if , then , contradicting the central limit theorem. Therefore, we get the following.
Corollary 2.
Let be such that and , and let . There exists an algorithm that runs in time on -regular -vertex graphs and whp outputs a canonical labelling of .
1.1 Related work
In [13, 37], it is proved that, when for a sufficiently small , then with high probability admits a canonical labelling via the 2-dimensional Weisfeiler-Leman algorithm (2-WL) [49], which is a generalisation of CR where the colouring is applied to pairs of vertices, and whose running time is [28]. The weaker version of 2-WL suggested by Bollobás [13] canonically labels in time whp. Moreover, Kučera [37] claimed that his version of the algorithm runs in average time for which we failed to verify333The paper does not provide a proof of this fact. However, the algorithm computes the vertices on shortest cycles as a subroutine and uses the following assertion [37, Theorem 3.1]: All cycles of the length in -regular graph can be found in time . First, we believe that the factor should instead read (for instance, it is unclear how all triangles could be found in time , say in a union of -cliques, there are triangles, which gives the lower bound on time needed to list them). Second, this bound (even with the fractional power) is not enough to get the expected time . Indeed, has a triangle with asymptotic probability . So we get the bound on the expected time to be at least as .. We therefore conclude this paragraph by asking whether there exists a linear-time algorithm – running in time on -regular -vertex graphs – that canonically labels whp, at least for some .
For binomial random graphs , the study of canonical labelling algorithms has been more extensive. Babai, Erdős, and Selkow [8] proved that CR outputs a canonical labelling of in linear time whp since it performs only a bounded number of refinement steps. The argument of [8] can be extended to show [14, Theorem 3.17] that the CR colouring of is whp discrete for all . Bollobás [13] showed a polynomial time canonical labelling algorithm for for some positive constants and , which is a weaker version of 2-WL. The next improvement was obtained by Czajka and Pandurangan [18]: they extended the range of applicability of CR to , which was finally extended to by Gaudio, Rácz, and Sridhar [25]. Linial and Mosheiff [39] showed that 2-WL outputs canonical labelling of whp when . Finally, a polynomial time algorithm that labels canonically whp for all was independently established in [5, 47], with CR as the main ingredient.
A partition of the vertex set of a graph is called equitable if, for any , any two vertices in have exactly the same number of neighbours in . Clearly, if a graph admits a non-trivial equitable partition , then CR does not refine it. The opposite statement is also true – if there is a partition that CR does not refine, then this partition is equitable. Clearly, Theorem 1 implies that whp CR refines any non-trivial partition of with any number of parts. Therefore, it implies that whp does not have an equitable partition other than those with 1 part or parts. If a graph has a non-trivial automorphism group , then for any non-trivial automorphism , its cycle decomposition identifies an equitable partition of . Since no graph with three or more vertices has a cyclic automorphism group acting without fixed points, the absence of a non-trivial equitable partition implies the absence of non-trivial automorphisms. As a result, Theorem 1 implies that is asymmetric whp for all such that and . This is a known result for the entire range , having been first established for in [42] and then for in [31].
1.2 Proof strategy
The key step to obtain Theorem 1 is to show that after some number of rounds of CR, one can coarsen the partition associated with colours to get a partition with parts of comparable size (for any desired arbitrarily large constant ). The following statement makes this precise. Note that we may coarsen a partition at any stage of the CR algorithm if it is convenient for the argument that follows. Clearly, one may couple the original process with the modified one so that the partitions in the original process are refinements of the corresponding partitions in the modified one. In particular, if the modified process reaches discrete colouring, then so does the original one.
Theorem 3.
Let be large enough, let , and let . Let be an arbitrary constant. Then, the following holds whp: for every non-trivial partition of the vertex set of , after rounds of CR, there exists a partition such that for any , and is a union of some colour classes (in other words, is a coarsening of the partition associated with resulting colour classes).
Once there are many parts of linear and comparable sizes, CR distinguishes all vertices after some additional number of rounds.
Theorem 4.
Let be large enough, let , and let . There exists some universal large constant such that the following holds whp: for every initial partition such that for any , , CR terminates on after at most rounds and outputs a discrete colouring.
Theorem 1 follows immediately from Theorem 3 and Theorem 4. To prove each of these two theorems, we address two regimes for separately: the dense case of , and the sparse case with . The corresponding statements are reiterated in Sections 3, 4, 5, and 6. Theorem 3 for is proved in Section 3. Its proof consists of two parts. First, we show that whp after one refinement round there exists a coarsening of the CR-partition such that , see Claim 16. One more round is needed to get all colour classes of size at most , for an arbitrary constant , see Claim 17. The latter claim follows from the fact that there is no large set with all vertices having the same degree profile with respect to . This is the main technical complication in the proof of Section 3 in the dense case: although this fact is easy to show in , in random regular graphs we cannot rely on local limit theorems. Instead we use asymptotic estimations of the number of graphs with a given degree sequence as well as anti-concentration properties of hypergeometric distribution. The sparse case is addressed in Section 4. Here, we show that, for every initial colouring , where , for a sufficiently small constant , after a few rounds of colour refinement, we will get a union of colour classes of size (Lemma 14). One more round is needed to get a set of size , for an arbitrarily large constant (Lemma 22). Then, similarly to the dense case, we show that there is no set of size more than such that all its vertices have same number of neighbours in , that gives us the desired partition (Lemma 20). All three lemmas rely on switching arguments. In particular, the last two lemmas use switchings to establish an analogue of Erdős–Littlewood–Offord theorem in the context of uniformly random graphs with a fixed degree sequence.
Theorem 4 is proved in Sections 5 and 6. The dense case is significantly easier. For instance, when , two refinement rounds are enough to obtain a discrete colouring whp. Indeed, let be two fixed vertices. Expose the neighbourhoods , and all the edges that touch . The exposed edges identify degree profiles of vertices in with respect to the fixed partition. Since the latter set has size , it is extremely unlikely that all the degrees are equal to the fixed values. Clearly, the probability of this event is in , which is enough to overcome the union bound, with room to spare. In order to transfer this bound to random regular graphs, we use asymptotic enumeration of graphs with a given degree sequence and anti-concentration inequalities for hypergeometric distribution, as for the dense case in Theorem 3. For , we need one additional refinement round in order to reach a set of vertices at distance at most 2 from of size . The sparse case , addressed in Section 6, requires a more delicate switching argument and constitutes the most technical part of the paper. Here, in order to reach a set of size , from fixed vertices , we need rounds. Then, in contrast to the sparse case in Theorem 3, we need a multidimensional analogue of Erdős–Littlewood–Offord theorem (Claim 29), since the degree profiles are considered with respect to sets of the partition. Nevertheless, the claim can still be established by applying a similar switching argument times.
1.3 Organisation
We start by presenting some preliminary results on properties of random graphs and concentration inequalities in Section 2. The rest of the paper is devoted to the proof of Theorems 3 and 4 which immediately imply our main Theorem 1. Theorem 3 is proved across Sections 3 and 4 where the dense and sparse cases are treated respectively. Sections 5 and 6 are devoted to the dense and sparse cases of Theorem 4.
1.4 Notation
For a graph , a set of vertices , and a non-negative integer , we denote by the sphere of radius around in the graph metric, omitting the dependency on since the underlying graph is always clear from the context. That is, consists of vertices such that the length of a shortest path from to equals . In particular, . We also denote the ball of radius around . We sometimes denote by and refer to it as the neighbourhood of . For a set of vertices and a vertex , we denote by the number of neighbours of in . We also use the standard notation for the subgraph of induced by a set , and for the bipartite subgraph with (disjoint) parts and , consisting of all edges of with one endpoint in and the other in . We often write to denote the union of two disjoint sets and . Finally, for a random variable with distribution , we write . In particular, is a binomial random variable with trials and success probability .
2 Preliminaries
In this section, we collect some probabilistic tools as well as properties of random regular graphs that we will use in the main proofs to follow. Proofs of Lemma 5, Corollary 6, Lemma 8, and Lemma 14 appear in the extended version of the paper [29].
2.1 Concentration Inequalities
2.2 Properties of Binomials
Let us start with a few auxiliary observations.
Lemma 5.
For all positive integers , ,
where and .
The preceding lemma has a useful corollary, which we record as follows.
Corollary 6 (Anti-concentration of hypergeometric distribution).
For integers , ,
| (3) |
and
| (4) |
where and . In particular, for all integers and positive integers ,
| (5) |
Moreover, for all integers ,
| (6) |
2.3 Counting Graphs
For a given degree sequence , we will use to denote the number of graphs on the vertex set with the degree sequence . The following result gives precise (asymptotic) bounds on (up to a multiplicative constant) for any degree sequence satisfying some mild condition. Dense graphs were investigated in [43] but the result was generalised to sparser graphs in [38].
Theorem 7 ([38, 43, 44]).
Let be any degree sequence such that is even and for all , for some , where is the average degree. Let be the number of edges, and . Suppose that for some . Then,
We say that a sequence is balanced if for any . The next observation is that is maximized (over all sequences with a fixed even sum) when is balanced.
Lemma 8.
Fix . The number of graphs on vertices and edges with a specified degree sequence (in particular, ) is maximized when the degree sequence is as even as possible. In other words,
where is the degree sequence, unique up to order, with only and .
We also recall the probability bound on the event that a uniformly random graph with a given degree sequence contains a specified set of edges.
Claim 9 ([41]).
Let be a uniformly random graph on the vertex set with a fixed degree sequence . Let be a graph on with degree sequence such that for all . Let and be the number of edges in and , respectively. Let and let . Then,
We note that Claim 9 immediately implies the following.
Claim 10.
Under the assumptions of Claim 9, for all large enough when the degree sequence is regular,
2.4 Sandwiching Graphs
Consider the binomial random graph which has vertex set and each potential edge is included independently at random with probability ; could be, and usually is, a function of that tends to zero as . Since the independence of the edges allows the use of a wide variety of techniques, is typically much easier to study compared to . As a result, it is tempting to hope for a general purpose “black box” theorem that is able to translate results between and . In 2004, Kim and Vu [33] formalized this desire in their famous “sandwich conjecture”. After more than 20 years and a number of important contributions [19, 22, 23, 34, 24], the conjecture was finally proved [11].
Theorem 11 (Theorem 1.1 [11]).
For each there is some such that the following holds for each . There is a coupling of random graphs such that , , , and whp .
2.5 Expansion Properties
We will use the expansion properties of random -regular graphs that follow from their eigenvalues. The adjacency matrix of a given -regular graph on vertices, is an real symmetric matrix. Thus, the matrix has real eigenvalues which we denote by . It is known that several structural properties of a -regular graph are reflected in its spectrum. Since we focus on expansion properties, we are particularly interested in the following quantity: .
The number of edges between two sets and in a random -regular graph on vertices is expected to be close to . (Note that does not have to be empty; in general, is defined to be the number of edges between to plus twice the number of edges that contain only vertices of .) A small (that is, a large spectral gap) implies that the deviation is small. The following bound is very convenient.
Theorem 12 ([3, 35]).
Let be a -regular graph. Then for any two sets of vertices , the number of edges of with one endpoint in and another endpoint in satisfies
We will apply the Expander Mixing Lemma (Theorem 12) together with an asymptotic bound on for random regular graphs. It was first established by Friedman [20] for constant , confirming the conjecture of Alon [2]. The case of was then conjectured by Vu [48]. After a series of important contributions [4, 15, 17, 36, 46], it was resolved for all by Bauerschmidt, Huang, Knowles, and Yau [10] and Sarid [45], and then for by He [26].
We will also require a finer expansion result ensuring that, for every set, its size remains concentrated after several rounds of expansion.
Lemma 14.
Let be small enough and be large enough (independent of ). Let and . Then, the following holds whp: for every set of size and for every positive integer such that ,
3 Proof of Theorem 3: Dense Case
Here we prove the following.
Theorem 15.
Let , , and let . Let be an arbitrary constant. Then, the following holds whp: for every non-trivial partition of the vertex set of , after two rounds of CR, there exists a partition such that for any , and is a union of some colour classes.
Theorem 15 follows easily from the following two claims.
Claim 16.
Let , , and let . For every , the following property holds whp: for every non-trivial partition with , after one round of CR, there exists a partition with such that and are unions of some colour classes (in other words, is a coarsening of the partition associated with resulting colour classes).
Claim 17.
Let , , and let . For any , there exists such that the following property holds whp: for every non-trivial partition with , there is no colour class of size more than after one round of CR.
The proof of the first claim is fairly straightforward and relies on the “sandwich theorem” (Theorem 11); it appears in the extended version of the paper [29]. Before we prove the second claim, let us show how they imply Theorem 15.
Proof of Theorem 15.
Since we aim for the statement that holds whp, we may assume that the statements in Claim 16 and in Claim 17 hold deterministically. Fix any , and let . Let be the large enough constant implied by Claim 17.
Consider any non-trivial partition . If , then after one round of CR (and coarsening), we get a partition into two colour classes where both of the colour classes have size at least (by Claim 16). After another round of CR, all colour classes have size at most (by Claim 17). If , then we get the above property after a single round of CR.
To get the desired partition into parts, each of size at least , one can iteratively merge any two colour classes of size at most until there is at most one such class remaining. After possibly merging this last class (if it exists) with any other arbitrarily chosen class, we get at least classes (but at most of them), each of size at least but at most . Finally, if there are more than classes, one can arbitrarily merge some triples of them (and, perhaps, one pair) to get exactly classes, each of size at most . This finishes the proof of the theorem.
In order to prove Claim 17, we will make use of the following simple observation (see its proof in the extended version of the paper [29]).
Lemma 18.
Let , , and let . For any , the following property holds whp: for any of size and any of size , the number of edges between and satisfies the following bounds
Proof of Claim 17.
Fix any and let be a large enough constant that will be specified later. In particular, we will assume that so that we may apply Lemma 18.
Suppose that there exists a partition with such that after one round of CR there exists a colour class of size more than . Note that this implies that every vertex in has the same number of neighbours in (hence every vertex in also has the same number of neighbours in ). If , then it will be convenient to concentrate on the number of neighbours in but if , then we will concentrate on the number of neighbours in . Our goal is to estimate the probability of the weaker but necessary property that there exists a pair of sets such that , , , and every vertex in has the same number of neighbours in .
Fix and such that and . Note that, in particular, . For each non-negative integer , define to be the event that every vertex in has exactly neighbours in . By Lemma 18, since we aim for a statement that holds whp, we may assume that the number of edges between and is at least and at most . Hence, we may restrict to considering such that
| (7) |
First, note that the expected number of edges induced by is . We will show that it is highly unlikely that the actual number deviates substantially from it. Let
By Theorem 7 and the Stirling’s formula (), letting , the number of -regular graphs on can be estimated as follows:
| (8) | ||||
Hence, the probability that the number of edges induced by is at most or at least can be upper bounded by
where is the hypergeometric random variable with parameters , , and . Clearly,
By Chernoff’s bound for hypergeometric distribution (see the comment right after (1), (2)),
Similarly, if , then the expected number of edges induced by is and we get that with probability , the number of edges induced by is at most or at least .
It remains to concentrate on the case when the number of edges induced by is between and , that is, when the average degree of the graph induced by is at least but at most . Let us first deal with the case when so we may additionally assume that the average degree of the graph induced by is at least but at most . By Theorem 7 and Lemma 8,
where denotes the number of edges between and , and
Indeed, there are at most ways to place edges between and , and at most ways to place edges between and . (Note that these values are trivial upper bounds but not the exact ones as some choices create vertices of degree more than .) It remains to estimate the number of graphs induced by the set and the number of graphs induced by the set . Importantly, once other edges are fixed, these graphs have a fixed degree distribution. In particular, the average degree of the graphs induced by is precisely . Similarly, the average degree of the graphs induced by is . Hence, we may use Theorem 7 and Lemma 8 to get upper bounds for the number of such graphs. (Let us point out that and are not necessarily integers. However, to keep the notation simple, we write instead of the product of terms, each of them being or .) Finally, since the average degree of the graph induced by and the one induced by are restricted, satisfies the requirements
| (9) | |||||
| (10) |
There are three binomials in the numerator of that are raised to powers that are functions of . We need to take advantage of them using Corollary 6 (see (5)). By (9),
| (11) | |||||
Similarly, by (10),
| (12) | |||||
Finally, by (7),
| (13) | |||||
For future reference, let us highlight that (12) only holds when , whilst the other two bounds (11) and (13) hold in general. Substituting in these three bounds, we get
Now, by Corollary 6 (see (6)), the latter quantity equals
By Corollary 6 (see (3)), we can collect all binomial coefficients together to get
Using (8) we get that
and so
Now, let and note that . Hence, is maximized for and we get that for any positive integer ,
since . It follows that
provided that is large enough so that . Since is fixed, this condition can be easily satisfied and we may now finally define the constant :
We conclude that if , then
If then, as mentioned earlier, we do not get the term in the estimation of (see (12)). However, for , this term does not help us much anyway: . Hence, regardless of the size of ,
Finally, by the union bound,
which finishes the proof of the theorem.
4 Proof of Theorem 3: Sparse Case
Sparser graphs clearly require more rounds of CR. Consider any -regular graph with diameter and let and be any two vertices at distance from each other. CR run on the initial partition and requires at least rounds to converge. Indeed, after rounds there are at least two vertices at distance at least from that are still of the same colour.
Theorem 19.
Let be large enough, let , and let . Let be an arbitrary constant. Then, the following holds whp: for every non-trivial partition of the vertex set of , after at most rounds of CR, there exists a partition such that for any , and is a union of some colour classes.
4.1 Anti-concentration Results
Lemma 20.
Let be a large enough constant, and let be another large enough constant. Let and . Then, the following property holds whp: for every set of size and every non-negative integer , the number of vertices in that have exactly neighbours in is at most .
Proof.
Due to Claim 10, the probability that there exists a set of size and a set of size such that the number of edges between and is more than is at most
Therefore, it suffices to prove the lemma for such that . So, we may assume that . On the other hand, by the Expander Mixing Lemma and Theorem 13, whp the number of edges between any set of size and any set of size is at most . So, we may also assume that .
Next, by the Expander Mixing Lemma and Theorem 13, whp, for every set of size and every set of size , there are at least edges between and , and at most edges between and .
Fix a set of size and a set of size . Fix a non-negative integer . Let us estimate the probability that every vertex from has exactly neighbours in . Let us order the vertices in arbitrarily: , where . Let be the event that every has neighbours in . Let and be integers such that
Let be the set of all -regular graphs on satisfying and such that and have exactly and edges, respectively. The following claim completes the proof of Lemma 20, see the proof in the extended version of the paper [29].
Claim 21.
.
Indeed, by the union bound over and the number of edges outside of (), we get that probability that there exist sets such that holds is at most
Lemma 22.
Let be large enough constant, and let be another large enough constant. Let and . Then, the following property holds whp: for every set of size and every integer such that , there are at most vertices that have exactly neighbours in .
Proof.
By the Expander Mixing Lemma and Theorem 13, whp every set of size induces at most edges. Let be the event that there exists a set of size with more than edges.
Let . Fix a set of size and a set of size . Divide , where consists of the first vertices. Expose edges inside and assume that has size at most . Let be the set of vertices that have at most neighbours in . Clearly, . Without loss of generality, we assume , where .
Let be the set of -regular graphs on such that and each vertex in has exactly neighbours in . Let be the set of -regular graphs on such that and
-
has neighbours in ,
-
each vertex has exactly neighbours in , except for some , whereas has neighbours in ,
We shall prove that . Take and consider a tuple of vertices such that
-
, , ,
-
and , .
If we switch
| (14) |
we get a graph from . For every the number of forward switchings is at least . On the other hand, for every graph , the number of backward switchings is at most . We get
implying , as desired.
We now let be the set of -regular graphs on such that
-
,
-
has neighbours in ,
-
each vertex has exactly neighbours in , except for (when ) and (when ) that have neighbours in .
Take and consider a tuple of vertices such that
-
, , , and ,
-
and , .
If we switch as in (14), then we get a graph from . For every the number of forward switchings is at least . On the other hand, for every , the number of backward switchings is at most , as before. Thus
implying , as well.
Similarly, we define . For the -th set , we get that
implying for all . In particular, we get
In a similar way, for every , . Thus, we get , implying . The union bound over and gives us that
which completes the proof of the lemma.
4.2 Proof of Theorem 19
With Lemmas 14, 20, and 22 at hand, we can easily prove Theorem 19.
Proof of Theorem 19.
Fix any , and let . Let be a small enough constant as in Lemma 14. Let be a large enough constant as in Lemmas 14, 20, and 22. Moreover, we will adjust constants or , if needed, for some of the claims below to hold. Since we aim for the statement that holds whp, we may assume that the statements in Lemmas 14, 20, and 22 hold deterministically.
Consider any non-trivial partition . Our goal is to show that after at most many rounds of CR, we get a partition into colour classes that have sizes at most . To get the desired partition into parts, each of size at least but at most , one can iteratively merge colour classes as we did in the proof of Theorem 15.
Let and let be a colour class of size . Suppose first that . Let be the largest integer such that . We may adjust and , if needed, to make sure that , which, in particular, implies that . It follows from Lemma 14 that
and clearly . After rounds of CR, is a union of some colour classes. We may merge them together at this point and continue the process from there.
Suppose now that is a colour class of size . Let be an arbitrary subset of of size . On the one hand, trivially, . On the other hand, it follows from Lemma 14 that which implies that , when is large enough. Since is a union of some colour classes, we may merge them into one large class and continue from there.
Suppose this time that is a colour class of size . We may adjust , if needed, to make sure . After one round of CR, is partitioned into sets (); set consists of vertices with exactly neighbours in . Let and let . Clearly, . Note that, on the one hand, the number of edges between and its complement is at least . On the other hand, it is trivially at most . We conclude that , and so
Our goal is to show that one can always merge some sets together to get a colour class of size at most but at least , which is at least , provided that is large enough. To that end, we will consider a few cases. If , then we can simply take the entire set for the desired colour class. If but , then we may take the entire set since and, trivially, .
It remains to concentrate on the case when . Suppose first that for some . It follows from Lemma 22 that . Then, we can take for the desired colour class since, trivially, and
provided that is large enough. If for some , then we may simply take as our colour class. Suppose then that for all . Then, we may start with set and remove ’s, one by one, and at some point we get a set of size at most but at least .
Finally, suppose that is a colour class of size . It follows immediately from Lemma 20 that after one round of CR, the complement of is partitioned into sets of size at most . We can group some of them together to get a colour class of size at least but at most to make sure that after one more round is also partitioned into sets of size at most . This completes the proof.
5 Proof of Theorem 4: Dense Case
Here, we prove the following.
Theorem 23.
Let , let , and let . There exists some universal large constant such that the following holds whp: for every partition of the vertex set of such that for any , , after three rounds of CR, there are only singleton colour classes.
We start from a simple auxiliary lemma, the proof of which is in the extended version of the paper [29].
Lemma 24.
Let , , and let . For every pair of vertices , let and be sets of size chosen uniformly at random. Then the following events hold whp for any pair of vertices in :
-
1.
;
-
2.
;
-
3.
whenever .
Proof of Theorem 23.
Due to the Expander Mixing Lemma and Theorem 13, whp between any set of size and any set of size , there are edges. We denote the intersection of this event with the event from the assertion of Lemma 24 by .
Suppose that is as large as needed, and fix any partition such that each part has size in the range as in the statement of the theorem. For each , define so that . Finally, for each vertex , we interpret as the colour of after rounds of CR. For our goal, it suffices to show that whp no two vertices have the same value of .
We proceed as follows. Fix a pair of vertices and expose the neighbourhoods of and . Note that if and only if there exists a bijection such that for any we have . Fix such a bijection (in ways). Define . Choose arbitrarily a set of vertices from , and let . Expose all edges that touch . Let
Due to symmetry we may assume and we extend the bijection to an injection such that, for every and every , we get and . The number of ways to define such an extension is at most .
Let , and . After exposing every edge except those between and , we can determine the values of for every (as every neighbour of every vertex in has been exposed). Therefore, the injection also identifies for every and every . Let denote the number of pairs with and such that and . The number of ways to choose the remaining neighbours of the vertices in is
where is the number of exposed edges. Indeed for any positive integers with and for we have by Corollary 6 that
Let us show that the event implies . Indeed, this event implies that (if , then and has size at least by the second assertion of Lemma 24; if , then ). Therefore, there are at least vertices in the union of such that . Thus, there are at least such . Fix such a . Since holds, any subset of size sends edges to . Moreover, . Indeed, if , then which has size at least by the first assertion of Lemma 24; if , then by the third assertion. The event also implies that number of vertices in that have less than or more than edges in , is . So, indeed .
Using (8) and letting , the probability that there exists and a partition such that is then at most
when is sufficiently large. This completes the proof of Theorem 23.
6 Proof of Theorem 4: Sparse Case
Here we prove the following.
Theorem 25.
There exists a universal constant such that the following holds. Let be large enough, let , and let . Then whp: for every partition of the vertex set of such that for any , , after rounds of CR, there are only singleton colour classes.
We will use two direct corollaries of Lemma 14 from Section 4 in this proof. We first state these in Section 6.1, and then prove Theorem 25 in Section 6.2.
6.1 Sizes of Balls
As in Lemma 14, let be small enough and be large enough. Let and let . The following two lemmas are direct corollaries of Lemma 14.
Lemma 26.
Whp, for every such that , the following holds
-
for every vertex ,
-
for every pair of vertices ,
Proof.
The first assertion is just Lemma 14 applied with . The second follows from in Lemma 14 together with the basic bound .
Lemma 27.
Whp
-
for every set of size , there are at least vertices that have a neighbour in ;
-
for any two disjoint sets of size , the number of vertices that have neighbours both in and in is at most .
Proof.
The first assertion follows immediately from Lemma 14 applied with . The second assertion follows as well since whp for any two disjoint sets and , the number of vertices that have neighbours in both sets is at most
6.2 Colour Refinement Run on a Vertex-coloured Random Graph
Let be large enough. In what follows we assume that properties from Lemma 26 and Lemma 27 hold in deterministically.
Fix a partition as in the statement of the theorem. Assign to every vertex the colour that equals the index of the set to which belongs. Let be the diameter of . Consider the output of rounds of CR at the coloured graph. We want to prove that for any two different vertices .
Fix two vertices . Assume . Then, for every neighbour of , there exists a neighbour of such that . More generally, we have the following.
Claim 28.
Let . For every vertex and every vertex such that , and every neighbour of , there exists a neighbour of such that .
Let , where is a small enough constant. By Lemma 26, we have that
Due to Claim 28, for every vertex , there exists a vertex such that . Next, for every vertex , let be one of its “parents”. We have that . Therefore, by Claim 28, there exists such that . We then define by induction: for every , assuming that has been defined on , and for every , find its “parent” and take such that .
Take of size and let . We have . Without loss of generality, we assume (otherwise, we can extend arbitrarily to keep the two sets disjoint, and the argument below will still work). Note that , that and that and are disjoint. The same facts hold for . In particular, . Therefore, by the conclusion of Lemma 27, we have that
Let be a subset of of size .
We then extend to : Each vertex has . Note that the set has size at least
The set is partitioned into sets so that .
Due to Claim 10, whp any set of size at most induces at most edges:
since is large and is small enough. In particular, we may assume that there are at most edges between and . We get that there exists a subset of size such that each vertex in this set sends at least edges to .
Note that, for any vertex , the equality implies . Therefore, as soon as the sets are exposed, the set is chosen, the sets are exposed, and the set is chosen, there should exist a function defined as above, that identifies the values of for every and .
Therefore, we run the following exploration process of the random graph. First, we expose and then choose of size arbitrarily. We then expose , , and . We choose on in at most ways, since
Finally, we choose any set of size such that each vertex in this set sends at least edges to .
By the Expander Mixing Lemma and Theorem 13, whp between any two disjoint sets of size at least and , there are at least edges, and every set of size at least induces at least edges.
Recall that every has a prescribed number of neighbours in the set . By the Expander Mixing Lemma and Theorem 13, whp the number of edges between any two disjoint sets and of sizes equals . Therefore, for every set , there exists a subset of size such that every has .
Let us estimate the probability that for every , every vertex from has neighbours in . For every , we order arbitrarily the vertices in : , where . Let be the event that, for every , every has neighbours in . Let and be integers such that
Let be the set of all -regular graphs on satisfying and such that, for all , and have exactly and edges, respectively444Sets and depend on : given a graph , we expose the balls around and , which identify these sets. In what follows, we will perform switching operations on that preserve the exposed balls and, therefore, sets and .. The following claim completes the proof of Lemma 20 (its proof appears in the extended version of the paper [29]).
Claim 29.
.
Indeed, Claim 29 implies that . Therefore, by the union bound
when is large enough and . The union bound over the choice of partition and over all pairs of distinct vertices completes the proof of Theorem 25.
References
- [1] J. Alman, R. Duan, V. Vassilevska Williams, Y. Xu, Z. Xu, and R. Zhou. More asymmetry yields faster matrix multiplication. In Proceedings of the 2025 Annual ACM-SIAM Symposium on Discrete Algorithms (SODA’25), pages 2005–2039, 2025.
- [2] N. Alon. Eigenvalues and expanders. Combinatorica, 6(2):83–96, 1986. doi:10.1007/BF02579166.
- [3] N. Alon and F. R. K. Chung. Explicit construction of linear sized tolerant networks. Discrete Mathematics, 72:15–19, 1988. doi:10.1016/0012-365X(88)90189-6.
- [4] N. Alon, M. Krivelevich, and V. H. Vu. On the concentration of eigenvalues of random symmetric matrices. Israel Journal of Mathematics, 131:259–267, 2002.
- [5] M. Anastos, M. Kwan, and B. Moore. Smoothed analysis for graph isomorphism. In Proceedings of the 57th Annual ACM Symposium on Theory of Computing (STOC’25), pages 2098–2106, 2025.
- [6] L. Babai. Graph isomorphism in quasipolynomial time. In Proceedings of the 48th Annual ACM Symposium on Theory of Computing (STOC’16), pages 684–697, 2016.
- [7] L. Babai. Canonical form for graphs in quasipolynomial time: preliminary report. In Proceedings of the 51st Annual ACM SIGACT Symposium on Theory of Computing (STOC’19), pages 1237–1246, 2019.
- [8] L. Babai, P. Erdős, and S. M. Selkow. Random graph isomorphism. SIAM Journal on Computing, 9(3):628–635, 1980. doi:10.1137/0209047.
- [9] L. Babai and E. M. Luks. Canonical labeling of graphs. In Proceedings of the 15th Annual ACM Symposium on Theory of Computing (STOC’83), pages 171–183, 1983.
- [10] R. Bauerschmidt, J. Huang, A. Knowles, and H.-T. Yau. Edge rigidity and universality of random regular graphs of intermediate degree. Geometric and Functional Analysis, 30:693–769, 2020.
- [11] N. Behague, D. Il’ković, and R. Montgomery. A proof of the Kim-Vu sandwich conjecture. arXiv preprint, 2025. arXiv:2510.20765.
- [12] C. Berkholz, P. Bonsma, and M. Grohe. Tight lower and upper bounds for the complexity of canonical colour refinement. Theory of Computing Systems, 60:581–614, 2017. doi:10.1007/S00224-016-9686-0.
- [13] B. Bollobás. Distinguishing vertices of random graphs. Annals of Discrete Mathematics, 13:33–50, 1982.
- [14] B. Bollobás. Random Graphs. Cambridge University Press, 2 edition, 2001.
- [15] A. Z. Broder, A. M. Frieze, S. Suen, and E. Upfal. Optimal construction of edge-disjoint paths in random graphs. SIAM Journal on Computing, 28(2):541–573, 1999. doi:10.1137/S0097539795290805.
- [16] N. Chiba and T. Nishizeki. Arboricity and subgraph listing algorithms. SIAM Journal on Computing, 14(1):210–223, 1985. doi:10.1137/0214017.
- [17] N. A. Cook, L. Goldstein, and T. Johnson. Size biased couplings and the spectral gap for random regular graphs. Annals of Probability, 46(1):72–125, 2018.
- [18] T. Czajka and G. Pandurangan. Improved random graph isomorphism. Journal of Discrete Algorithms, 6:85–92, 2008. doi:10.1016/J.JDA.2007.01.002.
- [19] A. Dudek, A. Frieze, A. Ruciński, and M. Šileikis. Embedding the Erdős–Rényi hypergraph into the random regular hypergraph and hamiltonicity. Journal of Combinatorial Theory, Series B, 122:719–740, 2017. doi:10.1016/J.JCTB.2016.09.003.
- [20] J. Friedman. A proof of Alon’s second eigenvalue conjecture and related problems. Memoirs of the American Mathematical Society, 195(910), 2008.
- [21] P. Gao. Triangles and subgraph probabilities in random regular graphs. Electronic Journal of Combinatorics, 31(1):P1.2, 2024. doi:10.37236/10281.
- [22] P. Gao, M. Isaev, and B. D. McKay. Sandwiching random regular graphs between binomial random graphs. In Proceedings of the Fourteenth Annual ACM-SIAM Symposium on Discrete Algorithms (SODA’20), pages 690–701, 2020.
- [23] P. Gao, M. Isaev, and B. D. McKay. Sandwiching dense random regular graphs between binomial random graphs. Probability Theory and Related Fields, 184(1–2):115–158, 2022.
- [24] P. Gao, M. Isaev, and B. D. McKay. Kim-Vu’s sandwich conjecture is true for . arXiv preprint, 2023. arXiv:2011.09449.
- [25] J. Gaudio, M. Z. Rácz, and A. Sridhar. Average-case and smoothed analysis of graph isomorphism. Annals of Applied Probability, 35(2):1373–1406, 2025.
- [26] Y. He. Spectral gap and edge universality of dense random regular graphs. Communications in Mathematical Physics, 405(181):1–40, 2024.
- [27] H. A. Helfgott, J. Bajpai, and D. Dona. Graph isomorphisms in quasi-polynomial time. arXiv preprint, 2017. arXiv:1710.04574.
- [28] N. Immerman and E. S. Lander. Describing graphs: A first-order approach to graph canonization. In Complexity Theory Retrospective, pages 59–81. Springer, New York, 1990.
- [29] M. Isaev, T. Makai, B. D. McKay, P. Prałat, J. Tan, and M. Zhukovskii. Canonical labelling of random regular graphs. arXiv preprint, 2026. arXiv:2602.17567.
- [30] S. Janson, T. Łuczak, and A. Ruciński. Random Graphs. Wiley, 2000.
- [31] J. H. Kim, B. Sudakov, and V. Vu. On the asymmetry of random regular graphs and random graphs. Random Structures & Algorithms, 21(3–4):216–224, 2002. doi:10.1002/RSA.10054.
- [32] J. H. Kim, B. Sudakov, and V. Vu. Small subgraphs of random regular graphs. Discrete Mathematics, 307:1961–1967, 2007. doi:10.1016/J.DISC.2006.09.032.
- [33] J. H. Kim and V. H. Vu. Sandwiching random graphs: universality between random graph models. Advances in Mathematics, 188(2):444–469, 2004.
- [34] T. Klimošová, C. Reiher, A. Ruciński, and M. Šileikis. Sandwiching biregular random graphs. Combinatorics, Probability and Computing, 32(1):1–44, 2023. doi:10.1017/S0963548322000049.
- [35] M. Krivelevich and B. Sudakov. Pseudo-random graphs. In More Sets, Graphs and Numbers, volume 15 of Bolyai Society Mathematical Studies, pages 199–262. Springer, 2006.
- [36] M. Krivelevich, B. Sudakov, V. Vu, and N. Wormald. Random regular graphs of high degree. Random Structures & Algorithms, 18:346–363, 2001. doi:10.1002/RSA.1013.
- [37] L. Kučera. Canonical labeling of regular graphs in linear average time. In 28th Annual Symposium on Foundations of Computer Science (SFCS’87), pages 271–279, 1987.
- [38] A. Liebenau and N. Wormald. Asymptotic enumeration of graphs by degree sequence, and the degree sequence of a random graph. Journal of the European Mathematical Society, 26:1–40, 2024.
- [39] N. Linial and J. Mosheiff. On the rigidity of sparse random graphs. Journal of Graph Theory, 85(2):466–480, 2017. doi:10.1002/JGT.22073.
- [40] E. Luks. Isomorphism of graphs of bounded valence can be tested in polynomial time. Journal of Computer and System Sciences, 25:42–65, 1982. doi:10.1016/0022-0000(82)90009-5.
- [41] B. D. McKay. Subgraphs of random graphs with specified degrees. Congressus Numerantium, 33:213–223, 1981.
- [42] B. D. McKay and N. C. Wormald. Automorphisms of random graphs with specified degrees. Combinatorica, 4:325–338, 1984.
- [43] B. D. McKay and N. C. Wormald. Asymptotic enumeration by degree sequence of graphs of high degree. European Journal of Combinatorics, 11:565–580, 1990. doi:10.1016/S0195-6698(13)80042-X.
- [44] B. D. McKay and N. C. Wormald. Asymptotic enumeration by degree sequence of graphs with degrees . Combinatorica, 11:369–382, 1991.
- [45] A. Sarid. The spectral gap of random regular graphs. Random Structures & Algorithms, 63(2):557–587, 2023. doi:10.1002/RSA.21150.
- [46] K. Tikhomirov and P. Youssef. The spectral gap of dense random regular graphs. Annals of Probability, 41(1):362–419, 2019.
- [47] O. Verbitsky and M. Zhukovskii. Canonical labeling of sparse random graphs. In 42nd International Symposium on Theoretical Aspects of Computer Science (STACS’25), pages 75:1–75:20, 2025.
- [48] V. Vu. Random discrete matrices. In Horizon of Combinatorics, volume 17 of Bolyai Society Mathematical Studies, pages 257–280. Springer, 2008. doi:10.1007/978-3-540-77200-2.
- [49] B. Weisfeiler and A. Leman. The reduction of a graph to canonical form and the algebra which appears therein. Nauchno-Technicheskaya Informatsia, 9(2):12–16, 1968.
