Nonrepetitively 3-colorable subdivisions of graphs with a logarithmic number of subdivisions per edge

We show that for every graph $G$ and every graph $H$ obtained by subdividing each edge of $G$ at least $O(\log |V(G)|)$, $H$ is nonrepetitively 3-colorable. In fact, we show that $O(\log \pi'(G))$ subdivisions per edge are enough, where $\pi'(G)$ is the nonrepetitive chromatic index of $G$. This answers a question of Wood and improves a similar result of Pezarski and Zmarz that stated the existence of at least one 3-colorable division with a linear number of subdivision vertices per edge.


Introduction
A sequence s 1 . . . s 2n is a square if s i = s i+n for each i ∈ {1, . . . , n}. A sequence is repetitive if it contains a consecutive subsequence that is a square and it is nonrepetitive (or square-free) otherwise. For instance, the words hotshots, repetitive and alfalfa are repetitive and the words total and minimize are nonrepetitive.
The work of Thue on nonrepetitive words is regarded as the starting point of combinatorics on words [14,15] (see [4] for a translation in modern mathematical English). He showed that there are infinite square-free sequences over three elements. Many generalizations and variations of this notion have been studied. In particular, the notion of nonrepetitive coloring of graphs was introduced by Alon et al. [1] (see [16] for a recent survey on this topic). We say that a coloring (either of the vertices or of the edges) of a graph is nonrepetitive if the sequence of colors of any path is nonrepetitive. The nonrepetitive chromatic number (resp. nonrepetitive chromatic index ) of a graph, denoted by π(G) (resp. π ′ (G)) is the smallest number of colors in a nonrepetitive coloring of the vertices (resp. the edges) of the graph. Alon et al. showed that π ′ (G) is in O(∆ 2 ) where ∆ is the maximum degree of G [1]. Different authors successively improved the upper bounds on the nonrepetitive chromatic number and the nonrepetitive chromatic index and the best known bound for the nonrepetitive chromatic number is also in O(∆ 2 ) [5,7,9,12].
Nonrepetitive coloring of subdivisions of graphs were also widely studied. We say that a graph G ′ is a subdivision of the graph G if G ′ is obtained by replacing each edge vw of G by a path P with endpoints vw, where the new paths are pairwise internally disjoints. If each edge is replaced by a path with at least d internal vertices then G ′ is a (≥ d)-subdivision of G. Barát and Wood proved that every graph has a nonrepetitively 4-colorable subdivision [2]. Pezarski and Zmarz reduced 4 to 3 [11] (solving a conjecture of Grytczuk [8]). This result is a strong generalization of Thue's result. In these two results, the number of division vertices per edge is O(|V (G)|) or O(|E(G)|). Djumović et al.showed that every graph has a nonrepetitively 5colorable subdivision with O(log |V (G)|) division vertices per edge [5]. Their result is in fact stronger than that since it holds in the list-coloring setting and that their bound is in fact O(log ∆) where ∆ is the maximal degree of the graph. Finally, Wood proved that every graph has a nonrepetitively 5colorable subdivision with O(log π(G)) division vertices per edge [16]. It is slightly stronger since it implies the same bound of O(log ∆), but it does not hold in the list-coloring setting and requires all the edges to be subdivided in the same amount of internal vertices. In a recent survey Wood asked the following question.
In this article, we give a positive answer to the first part of this question. In fact, we show that there exists a function f (n) = O(log n) such that any subdivision of any graph G with a least f (π ′ (G)) subdivision per edge is nonrepetitively 3-colorable. Since π ′ (G) is in O(∆ 2 ), the quantity O(log π ′ (G))) is smaller than O(log ∆)) which is itself smaller than the suggested O(log |V (G)|)). However, this is not clear how O(log π ′ (G))) compares to O(log π(G)) so we are not able to solve the second part of this question. The number of subdivision vertices per edge that we require is 558 log 2 (n) + O(1). This result is optimal in the sense that Ω(log n) division vertices are needed on some edges of any nonrepetitively O(1)-colorable subdivision of K n [10]. However, we expect the optimal multiplicative coefficient in front of the log to be much smaller than 558.
Moreover, we show that any subdivision is nonrepetitively colorable as long as each edge is subdivided enough. This is much stronger than showing that there exists one nonrepetitively colorable subdivision. Remark that all the aforementioned results only showed the existence of one nonrepetitively colorable subdivision. Our proof becomes much simpler if we only care about the existence of one nonrepetitively 3-colorable subdivision.
The article is organized as follows. We first provide in Section 2 some definitions and recall some useful results from the literature. Then in Section 3, we show the existence of a set of words that is needed for our main construction. In particular, we show that there are sets of n-good words of exponential size. In Section 4, we use these sets of n-good words to show our main result. The main idea is to start from a nonrepetitive coloring of the edges of a graph and to "encode" each color by a well chosen n-good word. In the last section, we discuss possible ways to improve the bound on the number of needed subdivisions per edge.
The main idea is implicitly to generalize the notion of square-free morphism. A morphism is a map h : Σ * → Σ * such that the image of each word is given by the concatenation of the image of the letters. A square-free morphism is a morphism such that the image of every square-free word is a square-free word. A directed graph is nonrepetitively colored if the sequence of colors of every directed path is nonrepetitive. Given a directed graph D, two sets of colors C and Σ, a nonrepetitive edge coloring φ : A(D) → C of D and a square-free morphism h : C → Σ. If we can subdivide D in such a way that the sequence of colors of the subdivision of any edge e is h(φ(e)), then this subdivision is nonrepetitively |Σ|-colorable 1 . We cannot use the same construction for undirected graphs. But if we can find a square-free morphism such that the image of every square-free word is square-free even if we replace the image of a letter by its mirror at some arbitrary positions, then we can use the same idea. There are extra technicalities, since we show that it works for any large enough subdivision. Naturally, the proof mostly relies on combinatorics on words.

Preliminaries
A word is a finite sequence over a finite set that we call the alphabet. A factor of a word is a contiguous subsequence of this word, that is, if there are two words p and s such that w = pf s then f is a factor of w. If p (resp. s) is empty then f is also a prefix (resp. a suffix ) of w. A prefix (resp. a suffix) of w is proper if it is not equal to w. The length of a word u is denoted by |u|. A word u occurs in v at position p, if the factor of length |u| of v that starts at position p is exactly u. The mirror image w of a word w is the word obtained by reading w from right to left. We let w 1 = w and w 0 = w.
We recall the following result from Shur on the number of square-free ternary words.
Since any factor of a square-free word is square-free, C sq is a submultiplicative function (i.e., we have C sq (i + j) ≤ C sq (i)C sq (j), for all i, j). By Fekete's Lemma we deduce the following Corollary of Theorem 1.
We now recall Turán's Theorem and a simple corollary.
Theorem 2 (Turán's Theorem). Let G be any graph with n vertices, such that G is K r+1 -free. Then the number of edges in G is at most Corollary 2. Any graph G contains independent set of size at least n 1+d(G) where d(G) is the average degree of G.
Proof. Let G be a graph of average degree d(G) and let H be the complement of G. Then the number of edges of H is By Turán's Theorem, this implies that H cannot be K n 1+d(G) -free. Hence, G contains an independent set of size n 1+d(G) as desired.

Good sets
Let σ = 1202120121021201021, σ = 1201021201210212021 be the mirror image and let ρ = σ0σ. By construction p is a palindrome, |σ| = 19 and |ρ| = 39. A word v is nice if ρvρ is square-free and contains only two occurrences of σ and two occurrences of σ. The only occurrences of σ and σ are inside the two occurrences of ρ. Let N be the set of nice words and for any integer n, let N n be the set of nice words of length n.
For all n ≥ 8750, let l n be the lexicographically least word of the set N n . We show in Lemma 7 that there exist nice words of every length at least 8750. So l n is properly defined for any n ≥ 8750.
A set of words S is mirror-free if for any word w from S such that w = w, w is not in S. For any integer n ≥ 8750, a set of words S ⊆ N n is n-good if it is mirror-free and if for all i ∈ {2n + 100, . . . , 7n} and all u, v ∈ S such that u = v the words ρuρvρl i , ρuρvρl i , ρuρvρl i and ρuρvρl i are square-free.
In Lemma 2, we show the central property of n-good set, but first we show the following Lemma as a warm-up exercise. Lemma 1. Let n ≥ 8750 be an integer, S be an n-good set, u, v ∈ S and i ∈ {2n + 100, . . . , 7n} be an integer then ρuρl i ρvρ is square-free.
Proof. Suppose, for the sake of contradiction, that ρuρl i ρvρ contains a square ww. First remark, that since S is an n-good set ρuρl i ρ and ρl i ρvρ are both square-free. Hence there exist a non-empty suffix x of ρu and a non-empty prefix y of vρ such that xρl i ρy is a square. Now l i ρ is not a factor of w since it contains only one occurrence of ρ and that l i is much longer than the gap between any other occurrences of ρ. For the same reason ρl i is not a factor of w. There exists x ′ , y ′ such that l i = x ′ y ′ and w = xρx ′ = y ′ ρy. Since |x ′ | + |y ′ | = |l i | ≥ 2n + 100, assume, without loss of generality that |x ′ | ≥ n + 50. Then |x ′ | > |y| and xp is a proper prefix of y ′ ρ which implies that there is a second occurrence of ρ in y ′ ρ. This contradicts the fact that l i is a nice word.
Lemma 2. Let k and n be two integers. Let S be an n-good set, Σ be an alphabet and f : Σ → S be an injective map. Then, for any square-free word w 1 . . . w k ∈ Σ k , any sequence of integers (s i ) 1≤i≤k ∈ {2n + 100, . . . , 7n} k and any sequence ( Proof. Suppose, for the sake of contradiction, that there is a square uu in and that there are no other occurrences of σ and σ than the 3k+1 occurrences that are inside the occurrences of ρ. . . , 7n}}. Then for any j, x j ∈ L if and only if j ≡ 2 mod 3. Since S is mirror-free, for any i, x i and x i+1 are different. Thus, by the definition of n-good sets and by Lemma 1, for any i, ρx i ρx i+1 ρx i+2 ρ is square-free. Thus there are at least 3 occurrences of ρ in uu. At least one of σ or σ appears twice in u. Assume, without loss of generality, that the middle of the square uu does not cut any occurrence of σ (if it is not the case we can use the same argument with σ instead). Then σ occurs at least twice in u.
Let l ≥ 2 be the number of occurrences of σ in u. Since the explicit occurrences of σ are the only occurrences, and that there are as many occurences of σ in the two consecutives occurences of u, there exist an integer i and words y, y ′ , z, z ′ such that y is a proper suffix of σx i−l σ0, y ′ z = x i σ0, z ′ is a prefix of x i+l σ0 and Moreover, the occurences of σ have to match each others and synchronise the rest of u, that is, y = z, y ′ = z ′ and for all j ∈ {0, . . . , l − 2}, Recall that, for any j, x j ∈ L if and only if j ≡ 2 mod 3.
We have three different cases to consider.
The function f is an injective and maps to S which is mirror-free, so the previous equation implies that for all j ∈ {0, . . . , l/3 − 1}, This implies that there is a square in w which is a contradiction.
Case i + 1 − l ≡ 0 mod 3: We use the same idea as in the previous case with the fact that for every j ≡ 0 mod 3, In this case we obtain that for all j ∈ {0, . . . , l/3 − 1}, This implies that there is a square in w which is a contradiction.
Case i+1−l ≡ 2 mod 3: This case is almost identical to the previous ones. We know that for every j ≡ 0 mod 3, x j = f (w j/3 ) r j/3 . Moreover for all j, i + 2 − l + 3t ≡ 0 mod 3. By the same argument, for all j ∈ {0, . . . , l/3 − 1}, This implies that there is a square in w which is a contradiction.
This property is essential to construct the nonrepetitive coloring of a subdivided graph. The idea is to encode the colors of the edges of a nonrepetitive edge coloring of the initial graph. Any vertex from the initial graph will be colored by 0 and the path corresponding to any edge colored c in the original graph should receive the color sequence σf (c)ρl i ρf (c)σ (with the l i of the right length). The fact that we can choose a different l i for every edge means that we can find a right encoding as long as the edge is subdivided enough. The fact that we can replace the encoding of each w i by the mirror image of the encoding means that we can take an arbitrary orientation of the subdivided edge to apply the encoding to the corresponding path.
We also need a variant of this property. This variant will be useful for paths that start and end in the subdivision of the same edge (i.e., paths that appear in the subdivision of a cycle).
Lemma 3. Let k and n be two integers. Let S be an n-good set, Σ be an alphabet and f : Σ → S be an injective map. Let w 1 . . . w k ∈ Σ k be a squarefree word such that w 2 w 3 . . . w k w 1 is also square-free. Let (t i ) 1≤i≤k ∈ {2n + 100, . . . , 7n} k be a sequence of integers, and (r i ) 1≤i≤k ∈ {0, 1} k be a sequence of 0 and 1. Let a and b be a pair of words such that f (w 1 )ρl t 1 ρf (w 1 ) r 1 ρ = ab.
Proof. Suppose, for the sake of contradiction, that there is a square uu in b Since w 1 w 2 . . . w k and w 2 w 3 . . . w k w 1 are both square-free, Lemma 2 im- also square-free. Hence the first occurrence of u starts in b and the second occurrence ends in a. Assume, without loss of generality, that the middle of the square does not cut an occurrence of σ. Since k > 3, we know that uu contains enough occurrences of σ to be synchronized by the occurrences of σ and this implies that the number of occurrences of σ in u is a multiple of 3.
With the same argument as in the proof of Lemma 2 one easily shows that for every i ∈ 1, . . . , k 2 − 1 , We also easily verify that This is only possible if w 1 = w k/2+1 . Thus, for every This is a contradiction since w 1 . . . w k is square-free.

Exponentially large good sets
We show in this subsection that there are exponentially many nice words of any length and we use that to show that there are exponentially large n good sets.
Let h : Σ → Σ * , be the map such that A word v is an image of w by h if v can be obtained by replacing each occurrence of any letter i of w by any word of the corresponding set h(i).
The set of images of w by h is denoted by h(w). The authors of [3] introduced h and showed the following property. 2
We will use h to show that the set of nice words has exponential growth. First, we need a few simple facts about h, σ and ρ. It is a bit tedious to verify the four claims of this Lemma by hand so we provide a simple computer program that verifies Lemma 4 3 . The first of this 4 facts implies that images by h synchronize, that is, as long as a factor of an image is of length at least 50 (the length of the images of two letters), there is a unique way to split it into different images by h. This kind of properties are really useful to establish that an image of a square-free word by h does not contains any large squares (i.e., squares that are large enough to allow us to use this synchronization property). On the other hand, the other facts are quit useful to establish that there are no short squares. With this lemma in hand it is relatively simple to provide a proof of Theorem 3 (which we will not do). We can use these facts to show that there are exponentially many nice words.
Proof. Let w and v be as in the Theorem statement. Let w 1 . . . w n = w with w 1 , . . . , w n ∈ {0, 1, 2} and for all i Recall that we need to show that ρvρ is square-free and contains only two occurrences of σ and two occurrences of σ. By 2., 3. and 4. of Lemma 4, any occurrence of σ or σ is in ρ, so it only remains to show that ρvρ is square-free.
Suppose, for the sake of contradiction, that there is a square in ρvρ, that is, there are words x, y ∈ {0, 1, 2} * and u ∈ {0, 1, 2} + such that ρvρ = xuuy. Theorem 3 implies that uu cannot be a factor of v. One easily verifies that ρ is square-free. Thus x is a proper prefix of ρ or y is a proper suffix of ρ. Assume, without loss of generality, that x is a proper suffix of ρ. Let r be the nonempty suffix of ρ such that xr = ρ. Fact 3. of Lemma 4 implies that the square uu is not a factor of ρv 1 v 2 v 3 , thus |uu| ≥ |v 1 v 2 v 3 | + 2 and v 1 is a factor of u. Thus rv 1 is a prefix of u. We have to distinguish between two different cases depending on the length of r.
Case |r| ≥ 4: By hypothesis |w| ≥ 4 and |v 2 . . . v n | ≥ 5 × 24 > |v 1 | + 2|ρ| ≥ |v 1 rρ| which gives |rv 1 | + |r+v+ρ| 2 < |rv|. We deduce that the |rv 1 | first letters of the second occurrence of u do not overlap with the final occurrence of ρ. This implies that rv 1 is a factor of v. From Fact 1. of Lemma 4, v 1 can only appear as the image of 0 and thus r must appear as the suffix of the image of a letter. However, it is easy to verify that r is not the suffix of any image of a letter if |r| ≥ 4 (it is enough to verify this with |r| = 4), which is a contradiction.
Case |r| ≤ 3: Then r is also the suffix of an image of 1 by h (since 021 is suffix of any image of 1). There is v 0 ∈ h(1) such that uu is also a factor of v 0 vρ. By hypothesis w was chosen such that 10w01 is square-free and Theorem 3 implies that there is no square in v 0 v. Thus the square in v 0 vρ overlaps with the final occurrence of ρ. By symmetry of the previous case, the square overlaps by at most 3 letters with the final occurence of ρ which implies that the square is also an image of 10w01 which is a contradiction since any image of 10w01 by h is square-free by Theorem 3.
We can deduce an exponential lower bound on the size of N n .
The set of images by h of two different words are distinct, hence Every letter has an image of length 24 and an image of length 25 by h. Thus for any integer n ≥ 14 × 25 2 = 8750 and any word w of length n 24 − 13 ≤ |w| ≤ n 24 , w admits at least an image of size n by h. That is, for any n ≥ 8750, By symmetry, there are exactly Csq(n) 6 square-free words over {0, 1, 2} of length n starting by 10. Moreover, one easily verifies that every square-free word over {0, 1, 2} of length 14 contains at least one occurrence of 01. Thus for every integer n, there are at least Csq(n) 6 ternary square-free words of length between n − 13 and n starting with 10 and ending with 01.
We can now apply Corollary 1, Together with equation (2), we conclude |N n | > 1.01 n 7.8 . We use the exponential lower bound to establish the existence of exponentially large n-good sets, but first we show one more property of nice words. Lemma 6. Let n be a positive integer and u, v ∈ N . If the word ρuρvρ is not square-free then u is a prefix of v or v is a suffix of u. In particular, if |u| = |v| then u = v.
Proof. Let n be a positive integer and u, v ∈ N n such that u = v. Let ww be a square in ρuρvρ. Since u and v are nice, ρuρ and ρvρ are square-free. Hence the second occurrence of ρ is a factor of ww. We also know that the only occurrences of σ in ρuρvρ (resp. of σ) are the three occurrences inside each occurrence of ρ.
Suppose, for the sake of contradiction, that there are two non-empty words u 1 and u 2 such that u = u 1 u 2 , w is a suffix of ρu 1 and a prefix of u 2 ρvρ. Since w contains ρ as a factors and that there are exactly three occurrences of ρ this implies that w = ρu 1 which is a contradiction with the fact that u 2 ρvρ does not starts with ρ. By symmetry, we reach a similar contradiction if we try to split v in v 1 v 2 .
Hence there exists ρ 1 , ρ 2 such that ρ 1 ρ 2 = ρ = σ0σ and w is a suffix of ρuρ 1 and a prefix of ρ 2 vρ. Assume, without loss of generality, that σ is a suffix of ρ 2 (otherwise σ is a prefix of ρ 1 and the rest of the argument is symmetric). Since the only occurrence of σ in ρuρ 1 is inside ρ, we deduce that ρ 2 uρ 1 = w. Since w is a prefix of ρ 2 vρ, u is a prefix of v or v is a prefix of u.
We can finally show the existence of exponentially large n-good sets.
Proof. Let N ′ n be the set obtained by removing from N n any prefix or suffix of every l i with i ∈ {2n + 100, . . . , 7n} and by keeping for each pair of mirror images only the lexicographically smallest of the two. Each l i is responsible for removing at most two words from N n so |N ′ n | ≥ |Nn|−10n 2 ≥ 1.01 n 15.6 − 5n. Since n > 8750, we can simplify the bound For any u, v ∈ N ′ n , we say that u forbids v if u = v and for some i ∈ {n + 1, n + 2, . . . , 5n}, ρuρvρl i ρ, ρuρvρl i , ρuρvρl i ρ or ρuρvρl i ρ contains a square.
We now count how many words v are forbidden by a given u. Let u, v ∈ N ′ n be such that u = v and ρuρvρl i ρ is not square-free. Lemma 6 implies that both ρuρvρ and ρvρl i ρ are square-free (since u = v and v is not a prefix of l i ). There is a non-empty suffix u ′ of ρu and a non-empty prefix l ′ of l i ρ such that the square ww = u ′ ρvρl ′ . Moreover, there exist two non-empty words v 1 and v 2 such that σvσ = v 1 v 2 and w = u ′ σ0v 1 = v 2 0σl ′ .
Indeed, the middle of the square cannot be located outside of σvσ since there would be too many occurences of σ or σ on one side of the square. Finally, remark that either v 1 contains σ as a prefix or v 2 contains σ as a suffix (both could be true). In both cases, using the fact that there are only two other occurrences of σ and σ, we deduce that |w| = |vρ|. Thus v 1 is a prefix of 0σl i ρ and v 2 is a suffix of ρuσ0 and v is uniquely determined by u, l i and the position of the square. There are |vρ| = n + 39 possible positions, less than 5n possibles values for l i , so u forbids at most (n + 39) × 5n words because of ρuρvρl i . The count is similar for ρuρvρl i , ρuρvρl i ρ and ρuρvρl i ρ, so u forbids at most (n + 39) × 5n × 4 words. This is upper bounded by 30n 2 since n > 8750.
Let G be the graph whose vertices are the words from N ′ n and such that two words share an edge if one of them forbids the other one. The set of words corresponding to any independent set of G is an n-good set. Let S be the set of words corrsponding to the largest independent set of G. Since every word forbids at most 30n 2 words, the average degree of the vertices of G is at most 60n 2 . By Corollary 2, there is an independent set of size at least |N ′ n | 60n 2 +1 . Thus |S| ≥ 1.01 n 16(60n 2 +1) .

The final construction
A graph G ′ is a (≥ a, ≤ b)-subdivision of a graph G if G ′ can be obtained by subdividing each edge of G in at least a and at most b division vertices.
In Lemma 8, we use our results on n-goods sets to show that, if each edge of the graph is subdivided enough, but not too much, then we can nonrepetitively 3-color the resulting graph. To obtain Theorem 5, we then show that we can easily handle the edges that have too many subdivision vertices.
Lemma 8. Let G be a graph and n ≥ 8750 an integer such that π ′ (G) ≤ 1.01 n 16(60n 2 +1) . Then for any (≥ 4n + 216, ≤ 9n)-subdivision G ′ of G, Proof. Let n, G and G ′ be as in the lemma statement. Let C be a set of colors of size π ′ (G) and φ be a nonrepetitive edge C-coloring of G. By Lemma 7, there is an n-good set S such that |S| ≥ π ′ (G). Let f be an injective map from C to S. Let o be an arbitrary orientation of the edges of G.
Let p be a path in G ′ whose two extremities do not belong to the subdivision of the same edge of G. Then it is a subpath of the subdivision of some path in G. Let e 1 , . . . , e k be this path of G. For all i ∈ {1, . . . , k}, let w i = φ(e i ), let r i be 0 if o(e i ) goes in the same direction as the orientation of the path and r i = 1 otherwise. For all i ∈ {1, . . . , k}, let d i be the integer such that e i is subdivided into d i vertices in G ′ and let t i = d i − 116 − 2n. Then by definition the sequence of colors of the path p from G ′ is a factor of Moreover, since φ is nonrepetitive, w 1 . . . w p is square-free. By Lemma 2, p is nonrepetitively colored by φ ′ . Now we need to show that the same property holds if the two extremities of a path p of G ′ belong to the subdivision of the same edge. If the path is short and completely contained in an edge then this is in fact solved as the previous case. Then the remaining case is that p starts in the subdivision of an edge e 1 of G, then leaves this subdivision, and comes back to it by the other side. Let e 1 , e 2 , . . . , e n , e 1 be the edges of G whose subdivision contains p. For all i ∈ {1, . . . , k}, let w i = φ(e i ). For all i ∈ {1, . . . , k}, define r i and t i as in the previous case. Then there are two words a and b such that f (w 1 )ρl t 1 ρf (w 1 ) r 1 ρ = ab and such that the sequence of colors of p is By Lemma 3, p is nonrepetitively colored by φ ′ . We showed that every possible path of G ′ is nonrepetitively colored by φ ′ which implies that φ ′ is a nonrepetitive 3-coloring of G ′ . Lemma 9. Let G be a graph and H be a subdivision of G then π ′ (H) ≤ 2π ′ (G) + 3.
Proof. Let φ be a nonrepetitive edge coloring of G over the set of colors C of size π(G). Let C ′ be the set of colors obtained by adding three new colors α, β, γ and for each color c ∈ C a new color c ′ .
Let φ ′ be an edge coloring of H such that for each edge e of G: • if e is not subdivided in H then it has the same color in H and in G, • if e is subdivided into two edges e 1 and e 2 then φ ′ (e 1 ) = φ(e) and φ ′ (e 2 ) = φ(e) ′ , • if e is subdivided in k ≥ 3 edges e 1 , . . . , e k , then φ ′ (e 1 ) = φ ′ (e k ) = φ(e) and the sequence φ ′ (e 2 ) . . . φ ′ (e k−1 ) is a square-free word over {α, β, γ}.
It is easy to verify that if there is a square in φ ′ then the colors inherited from φ form a square on G. . This implies c = 4n + 216. Let G ′ be a subdivision of G such that H is a (≥ 4n + 216, ≤ 9n)subdivision of G'. Let us first show that there exists such a graph H. Since 4n + 216 < 2 × (9n), for any integer x ≥ 4n + 216 there exists an integer γ(x) such that 4n + 216 ≤ x γ(x) ≤ 9n. Thus, for any edge e of G that is subdivided k times in H, we can choose e to be subdivided k γ(k) times in G ′ . By Lemma 9, 2π ′ (G) + 3 ≥ π ′ (G ′ ). Let us now show that we can apply Lemma 8 to G ′ and H. We can verify by simple computation that 16(60n 2 + 1) < 1.01 n/2 for any n ≥ 8750. Hence, by definition of n.
So n verifies the conditions of Lemma 8. Since H is a (≥ 4n + 216, ≤ 9n)subdivision of G ′ we can apply Lemma 8 and we conclude that π(H) = 3 .

Improving the coefficient
We showed in Theorem 5 that for any graph G as long as there are at least 558 log 2 (π ′ (G)) + O(1) division vertices per edge the resulting graph is 3colorable. This result is optimal in the sense that Ω(log n) division vertices are needed on some edges of any nonrepetitively O(1)-colorable subdivision of K n [10]. However, we can try to reduce the multiplicative constant 558. By being more careful on the computations, we can replace 558 by where γ(N ) is the growth rate of the set of nice words. By using our lower bound of 1.01 on the growth rate of the number of nice words (Theorem 4) we obtain the bound 279 log 2 (n) + O(1). But we expect the growth rate to be much closer to 1.3.
In fact, if instead of ρ = σ0σ we take any long enough square-free palindrome ρ ′ = σ ′ 0σ ′ then it is easy to adapt the proof from [13] to show that the growth rate of the set of square-free words that avoids σ ′ and σ ′ can be arbitrarily close to 1.3. It probably does not change the growth rate to add the constraint that ρ ′ wρ ′ be square-free for every element w. However, we do not know how to prove this second point, but if it holds we can then replace 1.01 by 1.3. Our lower bound on the number of required division vertices per edge becomes 10.56 log 2 (n) + O(1). We suspect that this coefficient would still be far from optimal.