Colored unavoidable patterns and balanceable graphs

We study a Tur\'an-type problem on edge-colored complete graphs. We show that for any $r$ and $t$, any sufficiently large $r$-edge-colored complete graph on $n$ vertices with $\Omega(n^{2-1/tr^r})$ edges in each color contains a member from certain finite family $\mathcal{F}_t^r$ of $r$-edge-colored complete graphs. We conjecture that $\Omega(n^{2-1/t})$ edges in each color are sufficient to find a member from ${\mathcal{F}}_t^r$. A result of Gir\~ao and Narayanan confirms this conjecture when $r=2$. Next, we study a related problem where the corresponding Tur\'an threshold is linear. We call an edge-coloring of a path $P_{rk}$ balanced if each color appears $k$ times in the coloring. We show that any $3$-edge-coloring of a large complete graph with $kn+o(n)$ edges in each color contains a balanced $P_{3k}$. This is tight up to a constant factor of $2$. For more colors, the problem becomes surprisingly more delicate. Already for $r=7$, we show that even $n^{2-o(1)}$ edges from each color does not guarantee existence of a balanced $P_{7k}$.


Introduction
The basic principle behind Ramsey theory is that no matter how a system is partitioned, there must exist an organized subsystem that is entirely contained inside one of the parts of the partition.Recently, numerous authors have pursued a line of research investigating the emergence of subsystems that are organized, yet meet every single part in the partition.Of course, to do so, one needs to assume that each part in the partition is sufficiently large.In order to state a prototypical result in this direction, we first give the following definition (to see results with a similar flavor which will not be addressed in the rest of this paper, see [1,10,11,21,23]).Let F t be the family of two-edge-colored complete graphs on 2t vertices where one color forms a clique of size t, or two disjoint cliques of size t.The following was conjectured by Bollobás, and proved by Cutler and Montágh.
Theorem 1.1 ( [7]).Let 0 < ε ≤ 1  2 be a real number and t ≥ 1 an integer.For large enough n, any two-edge-coloring of K n with at least ε n 2 edges in each color contains a member of F t .
Cutler and Montágh's argument shows that one can take n ≥ 4 t/ε to find a member of F t .Fox and Sudakov improved their result by showing that one can take n ≥ ε −ct for some absolute constant c, which is tight up to the value of c [14].In an attempt to generalize these results to a setting where an arbitrary number of colour classes are allowed, the following definition was given in [3].

Definition 1.2 ([3]
).Let k, t and r be positive integers.Let H := K kt be a complete graph on kt vertices whose edges are r-colored.H belongs to the family F r t if there is a partition V (H) = i∈[k] V i of the vertices of H into k parts, with |V i | = t, such that: 1.For all i, j ∈ [k], H[V i ] and H[V i × V j ] are monochromatic.
2. All r-colors are present in H.
3.Not all r colors are present in H \ V i , for any i ∈ [k].
We make a couple of remarks regarding this definition.By (1), the color of any edge in H depends only on the parts the endpoints come from.By (3), it is not hard to see that any graph in F r t can have at most 2r parts (see the argument in [3]).Hence, F r t is a finite set.Observe also that By a pattern, we denote a maximal subfamily of F r t consisting of graphs colored all the same up to permutations of their colors.There are two different patterns in F 2 t and nine different patterns in F 3  t , see an illustration of the latter in Figure 1.1.In general, the number of different patterns in F r t grows exponentially with r as one can embed the family of all non-isomorphic tournaments on r vertices into F r t by associating to each vertex a K t of a different color, and giving the bipartite graphs between the K t 's the color of the K t they point to in the tournament (see [22] for information regarding the number of non-isomorphic tournaments on n vertices).
We can now state the multicolor generalization of the result of Cutler and Montágh, due to Lamaison, and the first and the last author.
Theorem 1.3 ([3]).For any r ≥ 2, there exists a constant c := c(r) such that, for any ε > 0 and t ≥ 2, any r-coloring of a K n with n ≥ ε −ct and ε n 2 edges in each color contains a member of F r t .

Turán-bounds for colored unavoidable patterns
The bound in Theorem 1.3, up to the dependence of c on r, is optimal by a random construction, similar to the one given in [14].However, if one is interested in the minimum density of edges required of each color in order to force a member of F r t , assuming that each color has Θ(n 2 ) many edges is not necessary.To discuss this extremal aspect of the problem precisely, we first define the following Turán-type parameter.
Definition 1.4.Let r, t, n be positive integers.Let F be a family of r-edge colored graphs.We denote by ex r (K n , F) the minimum integer m (if it exists) such that, for any r-edge coloring of K n with more than m edges in each of the r colors, K n contains a member of F. If there is no such m, we set ex r (K n , F) = ∞.
We begin by a discussion of the the case when r = 2. Caro and the second and third author showed that there exists a δ := δ(t) such that ex 2 (K n , F t ) = Ω(n 2−δ ) when n is large enough [6].Shortly after, Girão and Narayanan [16] proved that δ = 1/t is best possible up to the involved constants, supposing that the well-known conjecture that ex(K t,t ) = Ω(n 2−1/t ) for all t is true [20] (we give a shorter proof of their result in Section 2.2).
For arbitrary r ≥ 3, the structure of the graphs in F r t is a lot more complicated (already for r = 3 there are 9 different patterns, see Figure 1.1).However, it is still natural to suspect that finding large bipartite graphs are the only barrier for finding the patterns in F r t , meaning that Ω(n 2−1/t ) edges in each color class should guarantee the existence of a member from F r t .We conjecture that this is indeed the case.Conjecture 1.5.For any r ≥ 2 and t ≥ 1, there exists a constant C := C(r, t) such that, for n large enough, ex r (K n , F r t ) ≤ Cn 2−1/t .We show that at this same density (with Ω(n 2−1/t ) edges) we can find a member from F s t , where s = t r r .
Figure 1: The patterns from F 3,t .The colored vertices represent cliques of the corresponding color, of size t.Similarly, edges represent complete bipartite graphs of the corresponding color between the associated cliques.
Theorem 1.6.For any r ≥ 2 and t ≥ 1, there exists a constant C := C(r, t) such that, for n large enough, ex r (K n , F r t ) ≤ Cn 2−1/t , where t = tr r−1 .
Observe that the result of Girão and Narayanan [16] does not follow from the above by setting r = 2.We discuss why the existing techniques fail to give optimal bounds for the above problem, how one could potentially remove the r r−1 factor, and why the case of r = 2 is much easier, in Section 2. In particular, we give a short proof of the result of Girão and Narayanan in Section 2.2.

Balanceable graphs
Next, we turn our attention to a more specific problem, concerning balanced colorings of paths.We say that an r-colored graph G is balanced if each of the r colors appears in precisely e(G)/r or e(G)/r edges.Further, we say that an r-coloring of E(K n ) contains a balanced copy of G if it admits a balanced embedding of G.The following parameter for the case r = 2 was introduced by Caro and the second and third author [6].Definition 1.7.Given a graph G and positive integers r and n, we set bal r (n, G) = ex r (K n , F bal (G)), where F bal (G) is the family of all r-colored copies of G in which each of the r colors appears in either e(G)/r or e(G)/r edges.We call bal r (n, G) the r-balancing number of G and, when r = 2, we will put bal 2 (n, G) = bal(n, G) and call it just the balancing number of G.A graph G with bal r (n, G) < ∞ for every sufficiently large n is called r-balanceable or, when r = 2, simply balanceable.
Caro et al. [6] characterized all balanceable graphs.It follows by this characterization that all balanceable graphs G have bal(n, G) = o(n 2 ).There are many non-balanceable graphs as well as many balanceable graphs, see [6,8,9] for several examples.There are many dense balanceable graphs (like some amoebas [4,6]) and also many graphs having linear balancing number (in n), like trees [6], and cycles C n with n ≡ 2 (mod 4) [8].For instance, bal(n, P 2k ) = k−1 2 + o(1) n, and the value was precisely determined in [6].Surprisingly, it turns out to be an intricate problem to determine even the order of magnitude of bal r (n, P rk ) for arbitrary r and k, as the next two results show.
We would expect that, in this scenario, bal r (n, P rk ) is in fact ∞, but this would require giving a construction with exactly the same number of edges from each color class.On the other hand, we have the following positive result: Theorem 1.9.Let r ≥ 2.Then, there exists a k 0 such that for all k ≥ k 0 , bal r (n, P 2rk ) = o(n 2 ).
We remark that while the dependence of k 0 on r our proof gives is possibly far from optimal, some threshold is necessary.Indeed, there exist members of F r t for every r where one color class separates all the remaining colors, thus making it impossible to embed a balanced P r (a rainbow path) in such graphs.As an example of such a member from F r t , one may start with r − 1 vertexdisjoint K n,n , each colored a distinct color, and color all the edges that remain in the r th color.An illustration can be found for r = 3 in the bottom-right part of Figure 1.1.
Having established that degeneracies arise for large r, we turn our attention to the function bal 3 (n, P 3k ).The following theorem establishes the growth of this function up to a constant factor of 2.
)n.We believe that the lower bound from Theorem 1.10 should be tight for arbitrary k but are only able to confirm this when k ≤ 2. When k = 1, it is not hard to show bal 3 (n, P 3 ) = 0 (Proposition 3.2), whereas for k = 2 some more work is needed.We state the latter result in the following theorem.

Organization of the paper
We begin by proving our general result, Theorem 1.6.This already implies bal 3 (P 3k ) = o(n 2 ), as one can check all members from F 3 t in Figure 1.1 admit balanced embeddings of P 3k .Afterwards, we prove much better bounds on this function, showing that in fact it grows linearly in n (Theorems 1.10 and 1.11).We proceed by proving Theorems 1.8 and 1.9, which summarize our understanding of the function bal r (n, P rk ) for arbitrary r.We conclude with some open problems in the Discussion section.
2 Proof of Theorem 1.6 We will use the following version of the dependent random choice lemma.

Lemma 2.1 ([13]
).For all K, t ∈ N, there exists a constant C such that any graph with at least Cn 2−1/t edges contains a set S of K vertices in which each subset X ⊆ S with t vertices has a common neighborhood of size at least K.
We will also use the following, which is essentially a consequence of iterating a bipartite version of the dependent random choice lemma from [3].Lemma 2.2 (Corollary 2.6 in [3]).Let r and t be positive integers, r ≥ 2. There exists N = N (r, t) such that the following holds for all n ≥ N .Let A 1 , A 2 , . . ., A t partition the vertex set of an rcolored complete graph, where 2 t+1 r log r n, such that every set X i is monochromatic and every complete bipartite graph between X i and X j is monochromatic.
We emphasize that the proof structure of the result in this section will be very similar to that of the main result from [3].We include the details for completeness, and to set up the scene for a discussion of the difficulty of removing the r r term in the exponent.
Proof of Theorem 1.6.Start with given integers r ≥ 2, t ≥ 1 and set t = tr r−1 .We want to show that there exists a constant C := C(r, t) such that, for n large enough, ex r (K n , F r t ) ≤ Cn 2−1/t .We choose a C with the benefit of hindsight, large enough to make sure the following calculations go through.Similarly, we choose a sufficiently large n, and consider an r-coloring of a K n with Cn 2−1/t edges in each color class.
First, we choose a K (with hindsight) such that K t , and apply,for each color class, Lemma 2.1 with t = t and K = rK to find a collection of rK -sized sets {S i } r i=1 , satisfying that all its t -subsets have rK common neighbors in color i (this can be done if C is large enough).The different sets S 1 , S 2 , • • • , S r can intersect, but we can manage to choose, without renaming, suitable subsets of each one in order to have r disjoint sets each with We now apply Lemma 2.2 to the collection , X i induces a monochromatic clique (of some color, not necessarily i), and the complete bipartite graph connecting vertices between X i and X j , with i = j, is monochromatic.Here, we make sure to select K large enough to ensure that |X i | exceeds t .Now, we use the property of the sets S i to find rK common neighbors of X i in color i.Call these sets Y i and, again, choose suitable subsets (without renaming) to ensure that we get a collection {Y i } r i=1 of disjoint sets, where Our aim is now to find monochromatic complete bipartite graphs between Y i and X j for all i = j.Associate to each vertex y of Y i a t r-long tuple with entries in [r] encoding the color of the edges (y, x) where x ∈ X i (recall | X i | = t r).As there are at most r t r such tuples, there must be |Y i |/r t r vertices in each Y i (call them Y i ) such that the associated tuple is identical.This means that for each x ∈ X j all the edges form x to vertices in Y i , are of the same color.
We may now fix subsets X i ⊆ X i of size |X i |/r r−1 so that the edges between Y j and X i , for i = j, are monochromatic (recall that the graphs are already monochromatic when i = j).Indeed, associate to each vertex x of X i an (r − 1)-long tuple with entries in [r] encoding the color of the edges from x to the sets Y j , j = i.So, for at least |X i |/r r−1 of the vertices its tuples are all identical.Call these sets X i and note that To finish, we apply Lemma 2.2 to the collection ), Y c induces a monochromatic clique and the complete bipartite graph connecting vertices between Y i and Y j , for i = j, is monochromatic.We select K to make sure this quantity exceeds t.Looking at the graph induced by the sets {X i } r i=1 and {Y i } r i=1 , we thus have a blow-up of a complete graph of order 2r with each blow-up of size at least t, where all r colors are used, so this structure must contain as a subgraph a member from 2.1 Removing the r r − 1 factor We now discuss the deficiency of the above proof, namely the loss of a constant factor of r r − 1, which we conjecture to be unnecessary.We lost this factor while trying to find monochromatic bipartite subgraphs between X i and Y j , for i = j.Obviously, to do so, one needs to shrink X i by some factor.Observe that, for the case r = 2, this step is not needed (as can be seen in the proof of Theorem 2.3 given in the next subsection).For r ≥ 3, the issue is that at this stage of the proof, we have already applied dependent random choice (Lemma 2.1), and fixed |X i | to be a subset of size t.
Once we do this, we cannot afford any further shrinking of X i to obtain the conjectural bound.One could hope to find the monochromatic bipartite graphs in a different order, perhaps finding all the bipartite graphs that are incident on X 1 , and proceeding inductively.The issue is once two subsets (say A and B) are fixed that are the two joint monochromatic neighborhoods of X 1 between which we are supposed to find a bipartite graph of a different color (say 2), we have no guarantee of finding even a single 2-colored edge between A and B. If A and B were linear sized subsets of a subgraph which is regular in color 2 however, this wouldn't be an issue.Here, regular is in the sense of the Sparse Regularity Lemma (for example, see [24]).Of course, for the regularity assumption to be useful, one needs more delicate dependent random choice type lemmas, which guarantee linear sized neighborhoods.This turns out to be not a serious issue, as there are such lemmas, for example see Lemma 6.3 in [13].
There is a caveat here, namely that if one wishes to find linear sized neighborhoods via a dependent random choice type lemma, one needs to tolerate a small fraction of subsets which don't have the desired large neighborhoods.However, we would only need a single subset with a large neighborhood, such that the subset is a clique.If the graph is large enough, there will be enough subsets that are monochromatic cliques so that one of them will have a large neighborhood.
So we believe that such a regularity based approach might prove to be fruitful to remove the r r−1 factor, but it is tricky to find even a single regular pair with many edges in sparse graphs.As noted in [24], when one applies the Sparse Regularity Lemma to a graph, it could be that none of the edges end up being between regular pairs of the given partition.This is in stark contrast to the dense case, where finding a single regular pair is a trivial consequence of the Szemerédi regularity lemma.

The case of r = 2
In this subsection, in an attempt to demonstrate the relative simplicity of Conjecture 1.5 when r = 2, we give a very short proof of this particular case, originally proved by Girão and Narayanan [16] using a more involved approach.Our version of the proof will essentially be an adaptation of an argument from [6], replacing the usage of the Kővari-Sós-Turán theorem with the dependent random choice lemma (Lemma 2.1).
Before we begin, we recall two definitions.Denote by R(k) the classical Ramsey number, that is, the smallest integer for which every 2-edge-coloring of K n , with n ≥ R(k), contains a monochromatic K k .Denote by BR(k) the bipartite Ramsey number, that is, the smallest integer for which every 2-edge-coloring of K n,n , with n ≥ BR(k), contains a monochromatic K k,k .All we need in the following proof is that R(k) and BR(k) are constants depending only on k, which is a well-known fact.

Theorem 2.3 ([16]
).For any t ≥ 1, there exists a constant C := C(t) such that, for n large enough, Proof.Given t, consider a 2-edge-coloring of K n (for n large) with Cn 2−1/t edges in each color class, where C is the constant given in Lemma 2.1 for t and K = R(BR(t)).Then we can find a red K t,BR(t) where both parts of the bipartite graph are monochromatic cliques.If either of these cliques are blue, we find a member of F t .So we may assume that both are red and thus, there is a red clique of size BR(t).Similarly, we may assume that there is a blue complete graph of the same order disjoint with the previous one.Consider now the 2-edge colored complete bipartite graph, K BR(t),BR(t) , induced by the vertices of those two cliques.By definition, there is a monochromatic K t,t in such complete bipartite graph, yielding the desired graph contained in F t .
We remark that the proof above is quite specific to the r = 2 case.Indeed, if we employed a similar strategy for the r = 3 case, for each monochromatic K t,BR(t) we find where both parts of the bipartite graph are monochromatic cliques, all we could conclude is that the entire structure does not use all three colors.In particular, instead of finding three large cliques of three different colors, we could end up with three large cliques with all the same colors.
3 Proofs of Theorems 1.10 and 1.11 Here we focus on upper and lower bounds for the function bal 3 (n, P 3k ).For convenience, we recall the corresponding result from the 2-color case, this time in its most precise formulation.
We remark that in [6] the extremal family of 2-edge-colored P 2k -avoiding complete graphs were explicitly characterized.

Preliminaries
In preparation for the proofs of Theorems 1.10 and 1.11, we first collect some helpful lemmas.In the proofs below, we always assume that the host graph has sufficiently many vertices.We start giving the 3-balancing number for P 3 .Observe that a 3-balanced P 3 is also known as a rainbow P 3 .Proposition 3.2.bal 3 (n, P 3 ) = 0.
Proof.Assume that we have a large 3-edge-colored complete graph with at least 1 edge from each color.There must exist a triangle with exactly two of the colors represented, say red and blue.No green edge can be adjacent to this triangle (otherwise we we can easily construct a rainbow P 3 ), but there must be a green edge.So, casing on the color of the edge between the green edge and one of the vertices of the triangle adjacent to both red and blue, we see that a balanced P 3 arises either way.
We will use notation P = x 0 x 1 . . .x k to represent a k-path with edges x i x i+1 for i ∈ {0, . . ., k−1}.Also we will call a 3-balanced K 3 a rainbow triangle because this is the term that is used in connection to Gallai-colorings, which we will use later.
Lemma 3.3.Let k ≥ 2. If a 3-edge-colored complete graph contains a balanced P 3k−3 and a vertexdisjoint rainbow triangle, then the graph contains a balanced P 3k .
Proof.Let P = x 0 x 1 . . .x 3k−3 be a balanced path which is vertex-disjoint to a rainbow triangle {x r , x g , x b } where x g x b is red, x r x g is blue and x b x r is green.If x 0 x r or x 3k−3 x r is blue or green, we we can easily construct a balanced P 3k (take P x r x or xx r P where x = x b or x = x g according to the color we choose).Thus, we may assume that both x 0 x r and x 3k−3 x r are red.Similarly, avoiding balanced P 3k s, the colors of x 0 x b , x 3k−3 x b , x 0 x g and x 3k−3 x g are determined to be blue and green respectively.Suppose now, without loss of generality, that the first edge of the path P , x 0 x 1 , is red.Then the path x 1 . . .x 3k−3 x b x g x 0 x r is a balanced P 3k .Now we show the lower bound from Theorem 1.10.Let k ≥ 2 and consider a 3-edge-coloring of K n where we split V (K n ) into three parts A, B, and C, with |A| = k−1 and |B| = |C| = (n−k+1)/2, and we color the edges as follows: edges between A and B red, edges between A and C blue, and all remaining edges in green.Since any balanced P 3k requires k red edges and k blue edges, and any such edge is incident on A, this graph contains no balanced P 3k .Further, the graph has at least (k − 1)(n − k + 1)/2 edges in each color class, implying bal as desired.
Before proving the upper bound of Theorem 1.10, we will first determine the 3-balancing number for P 6 .This will show that we are able to match the lower bound (1) when k = 2.

Proof of Theorem 1.11
In order to prove Theorem 1.11 we need the following lemmas.Lemma 3.4.If a 3-edge-colored complete graph contains two vertex-disjoint balanced P 3 s whose middle edges are different colors, then the graph contains a balanced P 6 .
Proof.Without loss of generality, assume that the first path P = x 0 x 1 x 2 x 3 is red-blue-green, and the second path P = x 4 x 5 x 6 x 7 is red-green-blue.If x 3 x 4 is blue or red, we have a balanced P 6 (take P P and remove either x 0 or x 7 according to the color of x 3 x 4 ).Similarly if x 0 x 7 is green or red, we have a balanced P 6 .Assuming these edges are green and blue respectively, we can see that x 7 x 0 x 1 x 2 x 3 x 4 x 5 is a balanced P 6 .
The above lemma will allow us to conclude that all balanced P 3 s in a 3-edge-colored complete graph without balanced P 6 s must be color isomorphic.This fact combined with the next lemma will allow us to conclude that in a 3-edge-colored complete graph with several balanced P 3 s and no balanced P 6 , the color of the middle edge of any of the P 3 s must be dense in the complete graph.Lemma 3.5.If a 3-edge-colored complete graph without a balanced P 6 contains two vertex-disjoint balanced P 3 s whose middle edges are of the same color, say blue, then any other edge between the vertices of these two paths (including edges contained within a single path) is blue.
Proof.Let P = x 0 x 1 x 2 x 3 and P = x 4 x 5 x 6 x 7 be two vertex-disjoint red-blue-green paths.If x 3 x 4 is red or green, we we can easily construct a balanced P 6 (take P P and remove either x 0 or x 7 according to the color of x 3 x 4 ).Hence, x 3 x 4 is blue.The same argument works to conclude that x 0 x 7 is blue.Observe that C = x 0 x 1 . . .x 7 x 0 is a red-blue-green-blue-red-blue-green-blue cycle.If x 0 x 2 is red then x 0 x 2 x 3 x 4 x 5 x 6 x 7 is a balanced P 6 .Also, by Lemma 3.3, x 0 x 2 can't be green (see triangle {x 0 , x 1 , x 2 } and path x 4 x 5 x 6 x 7 ).Thus, x 0 x 2 must be blue.A similar argument works to prove that all edges x i x i+2 , with i ∈ {0, . . ., 7} (where addition is taken modulo 8) are blue.Note now that x 3 x 7 can't be red (respectively, green) by P x 7 x 6 x 5 (respectively, P x 7 x 5 x 4 ).Thus, x 3 x 7 must be blue.Again, by taking advantage of the symmetry of C, we can conclude that all edges of the form x i x i+4 , with i ∈ {0, . . ., 7} and addition modulo 8, are blue.Finally, to conclude that the remaining edges are blue, we consider a new cycle C = x 0 x 1 x 3 x 2 x 4 x 5 x 7 x 6 x 0 which is color isomorphic to C and repeat the arguments.
We are now in a position to prove Theorem 1.11, in which we state that bal 3 (n, P 6 ) = ( 12 +o(1))n.
one green edge y 1 y 2 in I. Let z ∈ I \ {x 1 , x 2 , y 1 , y 2 }.Then all other edges between the vertices x 1 , x 2 , y 1 , y 2 and z are blue.Casing upon the color of the edge wx 1 , it is easily seen that there is a balanced P 6 within these vertices.For example, if wx 1 is red, then uvwx 1 y 1 y 2 z is a balanced P 6 .
The other two cases are done similarly.

Proof of upper bound of Theorem 1.10
In general, the best upper bound for bal 3 (n, P 3k ) we have is the following.
In order to prove (2), we will use the following theorem.Recall that the extremal number ex(n, H) is the maximum number of edges of a H-free graph on n vertices.Erdős and Gallai [12] determined the extremal number for paths.From this result, it follows that Now, we are ready to prove (2).Given a coloring on the edges of K n with red (r), blue (b) and green (g), we will use the following notation.For c ∈ {r, b, g} and a set S ⊆ V (K n ), we will denote by e c (S) the number of c-colored edges with both vertices in the set S. If S, T ⊆ V (K n ) are two disjoint sets, we set E(S, T ) for the set of edges with one vertex in S and one in T , and E c (S, T ) for the set of c-colored edges from E(S, T ).Moreover |E(S, T )| = e(S, T ), |E c (S, T )| = e c (S, T ), and Proof of (2).Let 0 < < 1 2 be arbitrary and let n be large enough such that all inequalities hold.Consider a 3-edge-coloring of K n with at least (k + )n edges of each color class.We proceed by induction on k to prove that there is a balanced P 3k .The case k = 2 was already done in Theorem 1.11.We assume that bal 3 (n, P 3k ) ≤ (k + o(1))n for any 2 ≤ k < k.Suppose now we have a complete graph on n vertices whose edges are colored with red, blue and green such that there are at least (k + ε)n edges from each color.By the induction hypothesis, there is a balanced P 3(k−1) , say P .Let C = V (P ) and D = V (K n ) \ C. We will distinguish two cases.
Case 1: D has no edges from at least one color.Assume, without loss of generality, that red is missing in D. Then e r (C, D) = e r (K n ) − e r (C) ≥ kn, if n is large enough.Subcase 1.1: Suppose that e b (D) ≥ k−1 2 + n and e g (D) ≥ k−1 2 + n.Then, by Theorem 3.1, there is a balanced blue-green 2k-path, say Q, contained in D.Moreover, since n is large, we still have e r (C, D \ V (Q)) ≥ kn.Hence, because of (3), there is a red k-path, say R, contained in the red graph induced by the edge set E r (C, D \ V (Q)).Let a, b ∈ Q be the end-vertices of the path Q, and let u, v ∈ V (R) be the end-vertices of the path R. We will show that there is a way of connecting both paths to have a balanced 3-colored P 3k .Consider the cycle S formed by the two paths Q and R and the edges au and bv.Let v v be the last edge in path R. If the edge ua is red, we can easily see that S − v is a balanced 3-colored 3k-path.Hence, au is either green or blue.The same occurs with the edge bv.Suppose now au and bv are both of the same color, say blue.Then the path consisting of the blue-green path Q together the edges au and bv has k + 2 blue edges and k green edges.Thus, it has to contain two consecutive blue edges, say xy and yz.Then S − y is a balanced 3-colored 3k-path.If, on the other side, au and bv are one blue and one green, then we can take two consecutive edges xy and yz from Q such that they have different color and we can see that S − y is a balanced 3-colored 3k-path.
We will show first that there is a blue, a red, and a green k-path, pairwise disjoint.
We will show now that e r (C \ V (B), D) ≥ k−1 2 n by using the fact that that holds because of (4).Indeed, Hence, by Erdős-Gallai (3), there is a red path on k edges, say R, contained in E r (C \ V (B), D).Finally, consider the set D = D \ (V (B) ∪ V (R)).Since there are only green and blue edges in D and e b (D) < k−1 2 − n by hypothesis of this case, we have Hence, the set D has Θ(n 2 ) green edges and thus clearly it has to contain a green k-path G, again by (3).
We will show now that with these three paths B, R and G, we can construct a balanced 3-colored P 3k .Let b, b be the end-vertices of B, r, r the end-vertices of R and g, g the end-vertices of G and consider the cycle S formed by the three paths together with the edges b r, r g and g b.Suppose two of the edges b r, r g, g b are of the same color, say green.We call c the color of the third edge.Then, no matter where this c-colored edge is situated, we can easily see that there is a 3-path wxyz contained in the cycle such that wx and xy are green and yz has color c.Deleting the vertices x and y from S gives a balanced P 3k and we are done.Hence we may assume that the edges b r, r g and g b are all from different color.If b r is green, we can consider the 3k-path that is formed by deleting vertices b and r from S. Similarly happens if r g is blue or g b is red.Hence, we may assume that the cycle S consists of a blue, a green and a red P k+1 glued together.Without loss of generality, we assume that b r is red, r g is green and g b is blue.Let r be the neighbor of r on the red path R and consider the edge gr and the cycle S = (S − r ) + gr .If gr is blue, then S − b is a balanced P 3k .
Let uv be a green edge in S and consider the path S − {uv}.Note that this new path, S − {uv}, plays the same role as P .Then, by Claim 2, all edges from {u, v} to D are green.Since there are no adjacent green edges in S, this leaves us (3k − 2) − 2k = k − 2 vertices allowed to send red or blue edges to D.
By a simple counting argument, it must be that S contains a subpath uvwz which is greennotgreen-green.Suppose, without lost of generality, that vw is red.

Claim 7:
The graph induced by the red edges in D is a matching.If this is not the case, take a red-red path, abc, in D. Consider a blue edge de in D. By Claim 1, we know that {d, e} ∩ {a, b, c} = ∅ and the edge cd is green.Let P = S − {v, w}.Note that P is a (3k − 5)-path with k − 1 blue edges, k − 2 red edges and k − 2 green edges.Hence, abcdeP is a balanced P 3k , as the edges from u (or z) to D are green, by considering S \ {wz} (or S \ {uv}).Now by using Claims 6 and 7, we can count the maximum number of red edges in order to get a contradiction.
which is not possible by hypothesis.Hence, we have shown that, for any 0 < < 1 2 , bal 3 (n, P 3k ) < (k + )n and we obtain the desired bound (2).

Balanced paths with many colors
In this section our goal is to prove Theorems 1.8 and 1.9.The former shows that it is hopeless to find a straightforward generalization of our bounds on bal r (n, P rk ) when r = 3 to arbitrary r, as it will be the case that for any odd k, there are infinitely many r such that bal r (n, P rk ) = Ω(n 2 ).On the other hand, the latter will give some hope of generalizing our bounds under the assumption that k is even and sufficiently large with respect to r.
Proof of Theorem 1.8.Given an odd k, we consider an r of the form r = l 2 + 1, with l ≥ 4, and l even.As there are infinitely many such r, it will be enough to display an r-colored complete graph on n vertices with Θ(n 2 ) edges in each color that avoids a balanced embedding of a P rk .
We divide the vertices of K n into l sets of size as equal as possible, and call them V i , i ∈ [l].We color each complete bipartite graph V i × V j , i = j, a different color.With the remaining color, say c l , we color everything else.That is, we color all edges contained in any of the V i 's the same color.
Towards a contradiction, assume that we have a balanced embedding of P rk into this coloring.We will now define an auxiliary multi-graph with vertex set {V i } i∈[l] .If we contract all edges of color c l of the balanced P rk in the embedding, we obtain a balanced copy of P (r−1)k .(This copy will not necessarily have a valid embedding onto the original graph, but we will simply use this P (r−1)k to define the edges of the auxiliary multigraph.) Every time the balanced P (r−1)k uses an edge between V i and V j , we add a new edge between the corresponding vertices in the multi-graph.Observe now that the embedding in the original graph corresponds to an Eulerian trail in the auxiliary multigraph.Thus each vertex in the multigraph corresponding to a V i which does not contain the start or end vertex of the embedding must have even degree.Observe further that such a vertex in the multigraph must exist, by our assumption that l ≥ 4. Finally, notice that such a vertex sends an odd number of edges to each of its neighbors, as k is odd, and it has an odd number of neighbors, as l is even, contradicting the fact that this vertex has even degree.
Proof of Theorem 1.9.Given r, our goal this time is to find a balanced copy of P 2rk (for k sufficiently large) in a coloring of a K n for n sufficiently large.Let k 0 be sufficiently large, it's value to be specified later in the proof.Let k ≥ k 0 , and we choose n so that an r-coloring of a K n with C r,k n 2−1/10rk = o(n 2 ) edges in each color class contains a member from F r 10rk , by Theorem 1.6.Fix such a coloring of a K n , and call the resulting unavoidable graph K.This K will require us to select a particular value of k 0 , for which k ≥ k 0 will be sufficient for the argument to go through.As it will follow that we get a corresponding value of k 0 for every possible K ∈ F r 10rk we end up with, we will set k 0 in the beginning of the proof as the maximum over all such k 0 (recall that there are only finitely many unavoidable configurations for each r).Hence for k ≥ k 0 , the embedding argument will go through, regardless of which graph K ∈ F r 10rk we start with.Now, having fixed a K, we will specify an embedding of P rk into K, and observe that we will never run out of edges in the process, as we were generous in the beginning, and each part in K has more than enough vertices to complete the embedding.
Let l be the number of parts in K (note l ≤ 2r − 2 by the remark in the Introduction), let V i (i ∈ [l]) be the parts in K, and let c i (i ∈ [r]) be the set of colors.Define C := {c i : c i is the color of one of the complete bipartite graphs V i × V j with i = j}.So C is the set of all colors that appear on edges going between the parts of K.
, it uses all r colors.If |C| = r, the claim is obvious.Otherwise, there are colors which appear only inside one of the V i .For any such color, note it is easy to insert a path of length k from that color into whatever embedding we already have, using only edges from that clique.This simple observation establishes the claim.
We proceed to find an embedding of P |C|k in K that uses only edges from the complete bipartite graphs.We do this again by associating an auxiliary graph, and arguing this auxiliary graph contains a Eulerian circuit.As we will find a circuit, our result will be valid even if we were trying to find a balanced cycle, as remarked in the Introduction.
For c i ∈ C, let #c i be the number of times the color c i appears in one of the bipartite graphs V i × V j .We now at last specify our choice of k 0 : where lcm denotes the least common multiple of a set.For k ≥ k 0 , we will now find a P |C|k in K minus the edges in one of the cliques.
As in the previous proof, we define a multi-graph for which the vertices correspond to the V i , and put 2k 0 /#c i many edges between each vertex corresponding to V i and V j , where c i is of course the color of V i × V j in K.As 2k 0 /#c i is an even integer, we find a Eulerian circuit in our graph, which naturally induces an embedding of a balanced P 2kr in K, allowing us to conclude.

Discussion
We conjecture that removing the r r term in the exponent in Theorem 1.6 is possible, and this remains an intriguing problem (Conjecture 1.5).We have already expanded on some tools which we believe will be useful in Section 2.1.Such a bound would be essentially tight, as further improvements would have to improve the best known bounds on ex(n, K t,t ).
Closing the gap from Theorem 1.10 is also an open problem.We conjecture that the lower bound should be the truth, but new ideas are needed to improve on our upper bound.
A perhaps more elementary question that remains is determining for which graphs G we have bal r (n, G) < ∞.We call an embedding of G into an r-edge-colored K n a balanced embedding if all r color classes are almost equally represented as in Definition 1.7.We have the following abstract characterization.
Proposition 5.1.Let G be any graph of order q, and r ≥ 2 an integer.Then bal r (n, G) = o(n 2 ) if and only if there exists a balanced embedding of G into all patterns from F r q .
Proof.If G admits a balanceable embedding into all patterns from F r q , by Theorem 1.6 we will be able to find balanced copies of G in sufficiently large complete graphs with Θ(n 2−1/v(G) ) edges in each color.On the other hand, if G does not admit a balanced embedding into a particular pattern from F r q , we can use this pattern to construct a K n with Θ(n 2 ) edges in each color class, hence it cannot be that bal r (n, G) = o(n 2 ).This characterization does not rule out the possibility that there might be balanceable graphs with bal r (n, G) = Θ(n 2 ).We find this to be unlikely, but we are unable to prove it for r ≥ 3, in contrast to the case r = 2, where it was shown that balanceable graphs have always bal(n, G) = o(n 2 ) [6].For example, by investigating Figure 1.1, one can verify that bal 3 (n, C 6k ) = o(n 2 ), and bal 3 (n, C 6k+3 ) = Ω(n 2 ).We leave it as an open problem to determine whether bal 3 (n, C 6k+3 ) = ∞.
It would in general be interesting to obtain results for cycles for r ≥ 3 (see [8] for the case r = 2).

Subcase 1 . 2 :
Suppose e b (D) < k−1 2 + n or e g (D) < k−1 2 + n.Without loss of generality, we assume e b (D) < k−1 2 + n.Then, since for n large enough we have e b (K n ) − e b (C) ≥ kn, and it follows that By the above inequality, e b (C, D) ≥ k+1 2 − n. and so by (3), the graph induced by the edges contained in E b (C, D) contains a path of length k + 1, say B .If k is odd, let x be one of the two end-vertices of B .If k is even, B has one end-vertex in C and one in D. In this case, let x be the end-vertex of B contained in C. Now define B = B − x.Observe that, for k even or odd, we have e r (K n ) = e r (C, D) + e r (D) + e r (C)

Claim 4 . 1 .
It is sufficient to embed a balanced P |C|k