Extremal problems and results related to Gallai-colorings

A Gallai-coloring (Gallai-$k$-coloring) is an edge-coloring (with colors from $\{1, 2, \ldots, k\}$) of a complete graph without rainbow triangles. Given a graph $H$ and a positive integer $k$, the $k$-colored Gallai-Ramsey number $GR_k(H)$ is the minimum integer $n$ such that every Gallai-$k$-coloring of the complete graph $K_n$ contains a monochromatic copy of $H$. In this paper, we consider two extremal problems related to Gallai-$k$-colorings. First, we determine upper and lower bounds for the maximum number of edges that are not contained in any rainbow triangle or monochromatic triangle in a $k$-edge-coloring of $K_n$. Second, for $n\geq GR_k(K_3)$, we determine upper and lower bounds for the minimum number of monochromatic triangles in a Gallai-$k$-coloring of $K_{n}$, yielding the exact value for $k=3$. Furthermore, we determine the Gallai-Ramsey number $GR_k(K_4+e)$ for the graph on five vertices consisting of a $K_4$ with a pendant edge.


Introduction
In this paper, we only consider edge-colorings of finite simple graphs. For an integer k ≥ 1, let c : E(G) → [k] be a k-edge-coloring (not necessarily a proper edge-coloring) of a graph G, where [k] := {1, 2, . . . , k}. A graph with an edge-coloring is called rainbow if all edges are colored differently, and monochromatic if all edges are colored the same. A Gallai-k-coloring is a k-edge-coloring of a complete graph without rainbow triangles, i.e. at most two distinct colors are assigned to the edges of every copy of K 3 .
Given a positive integer k and graphs H 1 , H 2 , . . . , H k , the classical k-colored Ramsey number R(H 1 , H 2 , . . . , H k ) is the minimum integer n such that every k-edge-coloring of K n contains a monochromatic copy of H i in color i for some i ∈ [k]. It is well-known that determining the exact value of the Ramsey number is an extremely difficult problem, even for relatively small graphs. Many variants of Ramsey numbers concerning rainbow structures have been studied, such as rainbow-Ramsey numbers, anti-Ramsey numbers and Gallai-Ramsey numbers. We refer to two surveys [12,31] for more information on these topics.
Given k graphs H 1 , H 2 , . . . , H k , the k-colored Gallai-Ramsey number GR(H 1 , H 2 , . . . , H k ) is defined to be the minimum integer n such that every Gallai-k-coloring of the complete graph on n vertices contains a monochromatic copy of H i in color i for some i ∈ [k]. In the special case when H 1 = H 2 = · · · = H k = H, we simply write R k (H) and GR k (H) for R(H, H, . . . , H) and GR(H, H, . . . , H), respectively. Gallai-Ramsey theory has been increasingly popular over the past decade. We refer to papers [3,11,17,18,27,28,34] for more information on some related problems.
A natural problem related to Gallai-Ramsey theory is to determine the maximum number of edges that are not contained in any rainbow copy of K 3 or monochromatic copy of H. The analogous problem for Ramsey numbers was considered in [23,29,30]; in these papers the authors studied the maximum number of edges not contained in any monochromatic copy of H over all k-edge-colorings of K n . For k ≥ 2, let f k (n, H) denote the maximum number of edges not contained in any rainbow triangle or monochromatic copy of H, over all k-edge-colorings of K n . The first part of this paper is devoted to this problem.
Let ex(n, H) be the maximum number of edges of an H-free graph of order n, i.e., the Turán number of H. By Turán's theorem, the unique K r+1 -free graph on n vertices with ex(n, K r+1 ) edges is the Turán graph T r (n), i.e., the complete r-partite graph on n vertices with class sizes as equal as possible. Let t(n, r) be the number of edges of T r (n). Note that we have the trivial upper bound f k (n, H) ≤ t(n, GR k (H) − 1). We also have a trivial lower bound f k (n, H) ≥ f 2 (n, H) ≥ ex(n, H). For the case H = K 3 , we will prove the following theorem.
We conjecture that the lower bound on f k (n, K 3 ) in Theorem 1.1 is in fact the exact value of f k (n, K 3 ). Moreover, we can generalize this result to a general graph H (see Theorem 3.4).
The second part of this paper is devoted to the Gallai-Ramsey multiplicity problem. By the definition of the Gallai-Ramsey number, if n ≥ GR k (H), then any Gallai-k-coloring of K n contains a monochromatic copy of H. In fact, there could be more than one monochromatic copy of H. In light of this, it is natural to consider the minimum number of monochromatic copies of H (as an unlabeled graph) in a Gallai-k-coloring of K n . Let g k (H, n) denote the minimum number of monochromatic copies of H taken over all Gallai-k-colorings of K n . The analogous problem for Ramsey numbers is known as the Ramsey multiplicity problem, that is, to consider the minimum number M k (H, n) of monochromatic copies of H taken over all kedge-colorings of K n (see [7,8,9,20] for some recent results). With the additional restriction imposed on Gallai-colorings, it is obvious that g k (H, n) ≥ M k (H, n). In 1959, Goodman [14] proved the following classical result concerning M 2 (K 3 , n).
There exists an integer n 0 such that for n ≥ n 0 , if we write n = 5m + r for nonnegative integers m and r with 0 ≤ r ≤ 4, then Our next result shows that g 3 (K 3 , n) = M 3 (K 3 , n) if n sufficiently large, and gives upper and lower bounds for g k (K 3 , n) for other values of k.
Moreover, let s 0 = 1 if k is odd, and s 0 = 2 if k is even. Then .
In general, we conjecture that the above upper bound on g k (K 3 , n) in Theorem 1.4 is in fact the exact value of g k (K 3 , n), but we can only verify this for the following cases: (1) k = 3 and n sufficiently large, (2) k ≥ 3 and n = GR k (K 3 ), (3) k is odd and GR k ( Finally, we consider the original problem, the Gallai-Ramsey number for a graph H. In [16], Gyárfás, Sárközy, Sebő and Selkow provided the following general statement on the value of the Gallai-Ramsey number GR k (H). Theorem 1.5. ( [16]) For any graph H and positive integer k, if H is not bipartite, then GR k (H) is exponential in k, and if H is bipartite but not a star, then GR k (H) is linear in k.
In [10], Fox, Grinshpun and Pach posed the following conjecture on an expression for the Gallai-Ramsey numbers of complete graphs in terms of their 2-colored Ramsey numbers. Conjecture 1.6. ( [10]) For integers k ≥ 1 and t ≥ 3, The cases with t = 3 and t = 4 of the above conjecture were verified in [5,16] and [28], respectively. Let K 4 + e denote the graph on five vertices consisting of a K 4 with a pendant edge. We prove the following related result, confirming that the expression in the above conjecture in fact also holds for K 4 + e (taking t = 5), since R 2 (K 4 + e) = 18 by a result in [19].
The remainder of this paper is organized as follows. In Section 2, we will introduce some additional terminology and notation, and list some known results that will be used in our proofs of the main results. In Section 3, we will prove Theorem 1.1, using a variant of the Gallai-Ramsey number. In Section 4, we will consider the Ramsey multiplicity problem for Gallai-colorings and prove Theorem 1.4. In Section 5, we will prove Theorem 1.7 in a more general form. Finally, we will conclude the paper with some remarks and open problems in Section 6.

Preliminaries
We begin with the following structural result on Gallai-colorings of complete graphs.
Theorem 2.1. ( [13,17]) In any Gallai-coloring of a complete graph, the vertex set can be partitioned into at least two nonempty parts such that there is only one color on the edges between every pair of parts, and there are at most two colors between the parts in total.
We call a vertex partition as given by the statement in Theorem 2.1 a Gallai partition. Below we listed some known exact values of Gallai-Ramsey numbers and Ramsey numbers. [5,16]) For integers k ≥ 1, we have Theorem 2.3. The following Ramsey numbers have been established: (2) ([6]) R(K 4 + e, K 3 ) = 9.
For a graph H, let ∆(H) and χ(H) be the maximum degree and chromatic number of H, respectively. Given an edge-colored graph F and an edge e ∈ E(F ), let c F (e) (or simply c(e)) be the color used on (i.e., assigned to) edge e. For U , V ⊆ V (F ) with U ∩ V = ∅, we use E(U, V ) (resp., C(U, V )) to denote the set of edges between U and V (resp., the set of colors used on the edges between U and V ). If all the edges in E(U, V ) are colored by a single color, then we use c(U, V ) to denote this color. Let F [U ] be the subgraph of F induced by U ⊆ V (F ), and F − U be the subgraph of F induced by V (F ) \ U (if U = V (F )). In the special case when U = {u}, we simply write E(u, V ), C(u, V ), c(u, V ) and F − u for E({u}, V ), C({u}, V ), c({u}, V ) and F − {u}, respectively. Let C(F [U ]) (or simply, C(U )) and C(F − U ) denote the set of colors used on E(F [U ]) and E(F − U ), respectively. For two graphs F 1 and F 2 , let F 1 ∪ F 2 be the disjoint union of F 1 and F 2 .
In the following, we will introduce the Regularity Lemma, Embedding Lemma and Slicing Lemma that will be used in our proof of Theorem 1.1. Given a graph F and two disjoint nonempty sets X, Y ⊆ V (F ), the density of (X, Y ) is defined to be For a positive real number d, we say that an ε-regular pair  (ii) for all 1 ≤ i < j ≤ t, we have ||V i | − |V j || ≤ 1; and (iii) for all but at most ε t 2 pairs (i, j), the pair (V i , V j ) is ε-regular for each color. We call the partition as given in Lemma 2.4 a multicolored ε-regular partition. Given ε, d > 0, a k-edge-colored graph F and a partition V 1 , V 2 , . . . , V t of V (F ), we define the reduced graph R = R(d) as follows: V (R) = {1, 2, . . . , t} and i and j are adjacent in R if (V i , V j ) is ε-regular for each color and there exists a color with density at least d in E(V i , V j ). Moreover, we define the multicolored reduced graph R c = R c (d) as follows: V (R c ) = V (R), E(R c ) = E(R), and for each edge ij ∈ E(R c ), ij is assigned an arbitrary color c 0 such that (V i , V j ) has density at least d with respect to the subgraph of F induced by the edges of color c 0 .
Given two graphs G and H, we say that G is a homomorphic copy of H if there is a map ϕ : V (H) → V (G) such that ϕ(u)ϕ(v) ∈ E(G) for each edge uv ∈ E(H). Note that K s is a homomorphic copy of H if and only if s ≥ χ(H). We will use the following consequence of the Embedding Lemma. Lemma 2.5 below is in fact a corollary of Lemma 2.4 in [21]. Lemma 2.5. (Multicolor Embedding Lemma) (see e.g. [21,22,24]) For every d > 0, any positive integer k and any graph G, there exist ε = ε(k, d, G) > 0 and a positive integer n 0 = n 0 (k, d, G) with the following property. Suppose that F is a k-edge-colored graph on n ≥ n 0 vertices with a multicolored ε-regular partition V 1 , V 2 , . . . , V t which defines the multicolored reduced graph R c = R c (d). If R c contains a monochromatic homomorphic copy of G, then F contains a monochromatic copy of G. If R c contains a rainbow copy of G, then F contains a rainbow copy of G.
Lemma 2.6. (Slicing Lemma) (see e.g. [24,29] Finally, we consider the Turán number. It is well-known that ex(n, K r+1 ) = t(n, r) We will use this more precise bound in our proofs of the main results.
3 On edges not contained in a rainbow triangle or monochromatic copy of H For the proof of Theorem 1.1, we first define the following variant of the Gallai-Ramsey number. Given a set V and an integer k ≤ |V |, let V ≤k (resp., V k ) be the set of all nonempty subsets of V of size at most k (resp., size k). contains either a rainbow triangle or a monochromatic homomorphic copy of H; In other words, GR * k (H) − 1 is the maximum integer n * * such that for the complete graph K n * * with vertex set [n * * ], there exists a coloring c : is a Gallai-k-coloring without a monochromatic homomorphic copy of H; and For a set H of graphs, let GR k (H ) denote the minimum integer n such that every Gallai-k-coloring of K n contains a monochromatic copy of H for some H ∈ H .
(3) if there exists a coloring c satisfying conditions (1 * * ) and (2 * * ) such that all elements of Proof. Let n * k := GR k−1 (H ). We first prove (1). Let F be a Gallai-(k − 1)-coloring of K n * k −1 without a monochromatic copy of H ′ for any H ′ ∈ H . We color the vertices of F with the kth color and then we obtain a k-coloring of [n * satisfying conditions (1 * * ) and (2 * * ).
We color the edges of G ′ such that for any . Let G ′′ be a k-edge-coloring of K n obtained by coloring the edges within each part using color k from the above (k −1)-edge-coloring of G ′ . We claim that all the edges between the n * k − 1 parts are neither contained in a rainbow copy of K 3 nor in a monochromatic copy of H in G ′′ . Indeed, note that there is no rainbow copy of K 3 using color k. Thus if G ′′ contains a rainbow copy of K 3 , then G is not a Gallai-coloring, a contradiction. If there is an edge e between these n * k − 1 parts such that e is contained in a monochromatic copy of H, then G contains a monochromatic homomorphic copy of H, a contradiction.
Let c be a coloring as in the statement of the lemma, and we may assume that all elements of [n k ] 1 are colored by color 1. Note that the restriction of c to [n k ] 2 is a Gallai-(k − 1)-coloring without a monochromatic homomorphic copy of H. Let W be the Turán graph T n k (n) with parts V 1 , . . . , V n k . We color the edges of W such that c W (V i , V j ) = c({i, j}) for any 1 ≤ i < j ≤ n k . Let W ′ be a k-edge-coloring of K n obtained by coloring the edges within each part using color 1 from the above (k − 1)edge-coloring of W . It is easy to check that all the edges between the n k parts are neither contained in a rainbow copy of K 3 nor in a monochromatic copy of H in W ′ . Thus f k (n, H) ≥ |E (W )| = t(n, n k ).
Note that we have GR * k (H) = GR k−1 (H ) = 2 whenever H is a bipartite graph, where H is the set of all homomorphic copies of H. A natural question is for which non-bipartite graph H it holds that GR * k (H) = GR k−1 (H )? We can verify that K 3 is such a graph.
We will prove it for k ′ = k. Let n be the maximum integer such that there is a coloring c : [n] ≤2 → [k] satisfying conditions (1 * * ) and (2 * * ). It suffices to show that n ≤ n * k − 1. By Theorem 2.1, there is a Gallai partition For avoiding a monochromatic copy of K 3 , we have m ≤ 5. We choose such a partition so that m is minimum. Let R be an edge-coloring of a complete graph with V (R) = {v 1 , v 2 , . . . , v m } and c(v i v j ) = c(V i , V j ) for any i = j. If m = 5 (resp., m = 4), then R is the unique 2-edge-coloring of K 5 without a monochromatic copy of K 3 , i.e., each color forms a cycle of length 5 (resp., R is one of the two 2-edge-colorings of K 4 without a monochromatic copy of K 3 , i.e., each color forms a path of length 3, or one color forms a cycle of length 4 and the other color forms a matching with two edges). Then there is no edge using color 1 or 2 within each part V i for avoiding a monochromatic copy of K 3 , and there is no vertex using color 1 or 2 within each part V i by condition (2 * * ). Thus if k = 3, then . This implies that V 1 and V 2 ∪ V 3 form a Gallai partition with exactly two parts, contradicting the minimality of m. If m = 2, then we may assume c(V 1 , V 2 ) = 1. Then color 1 cannot be used on As in the proof of Lemma 3.2 (1), we can construct an extremal coloring [GR * in which we assign a single color to all elements of [GR * . It is worth noticing that not all the extremal colorings assign a single color to all singletons. For example, Figure 1 gives an extremal coloring of GR * 4 (K 3 ) with two colors on singletons. Proof of Theorem 1.1. The lower bound follows from Lemmas 3.2 (2) and 3.3. Next, we will prove that f k (n, K 3 ) < t(n, GR k−1 (K 3 ) − 1) + δn 2 . Let nim k (n, K 3 ) be the maximum number of edges not contained in any monochromatic copy of K 3 over all k-edge-colorings of K n . Note that f k (n, K 3 ) ≤ nim k (n, K 3 ). For sufficiently large n, since nim 2 (n, K 3 ) = t(n, 2) (proven in [23]) and nim 3 (n, K 3 ) = t(n, 5) (proven in [29]), we have f k (n, In the following, we may assume k ≥ 4. ) and n 1 = n 1 (k, d/2, K 3 ) (resp., ε 2 = ε 2 (k, d, K 3 ) and n 2 = n 2 (k, d, K 3 )) be the values obtained by applying Lemma 2.5. Let n ′ 1 and M 1 be the values obtained by applying Lemma 2.4 with ε 1 and 1/ε 1 . Then we choose ε such that ε ≤ min {δ/4, ε 1 /M 1 , ε 2 , d/2}. Let n ′ and M be the values obtained by applying Lemma 2.4 with ε and 1/ε. Let n 0 = max n ′ , n ′ 1 M, (N k − 1)/(2δ), M M 1 n 1 /3, n 2 and n ≥ n 0 . Let F be a k-edge-coloring of K n , and F ′ be the spanning subgraph of F with E(F ′ ) = {e ∈ E(F ) : e is not contained in any rainbow or monochromatic copy of K 3 }. For a contradiction, suppose |E(F ′ )| ≥ t(n, N k − 1) + δn 2 . Let V 1 , V 2 , . . . , V t be a partition of V (F ′ ) obtained by applying Lemma 2.4 to F ′ with ε and 1/ε, where 1/ε ≤ t ≤ M . Let R = R(d) be the reduced graph. Since there are at most n/t 2 edges within a part, at most (n/t) 2 edges between any two parts, and less than kd (n/t) 2 edges between a pair of parts with density less than d for each color, we have where the last inequality is by the choices of n, d and ε. Thus |E(R)| ≥ t(t, N k − 1) + 1, so R contains a copy R ′ of K N k . Without loss of generality, let V (R ′ ) = {1, 2, . . . , N k }. Then for any 1 ≤ i < j ≤ N k , we have that (V i , V j ) is ε-regular for each color, and there exists a color c ij with density at least d in Thus we can apply Lemma 2.4 with ε 1 and 1/ε is an (ε 1 , d/2)-regular pair for color c i . We define a coloring ϕ : Note that there might be more than one choice for ϕ({i}) and ϕ({i, j}), and we may choose an arbitrary one from these choices. By Lemma 3.3, we have |V (R ′ )| = N k = GR k−1 (K 3 ) = GR * k (K 3 ). Thus at least one of the following statements holds: (1) R ′ contains a rainbow copy of K 3 ; (2) R ′ contains a monochromatic homomorphic copy of K 3 ; (3) ϕ({i, j}) = ϕ({i}) for some 1 ≤ i = j ≤ N k . If (1) or (2) holds, then there is a rainbow or monochromatic copy of K 3 in F ′ by Lemma 2.5, a contradiction. If (3) holds, then by applying Lemma 2.6 with α = 1/M 1 , we have that (V j , V i,1 ) and (V j , V i,2 ) are two (εM 1 , d − ε)-regular (and thus (ε 1 , d/2)-regular) pairs for color c i . Thus (V i,1 , V i,2 ), (V j , V i,1 ) and (V j , V i,2 ) are three (ε 1 , d/2)-regular pairs for color c i . By Lemma 2.5, there is a monochromatic copy of K 3 which contains two edges of F ′ , a contradiction.
By similar arguments as in the proof of Theorem 1.1, we can prove the following result for a general graph H. We omit the details.

The Ramsey multiplicity problem for Gallai-colorings
We first prove the upper bound in Theorem 1.4, by construction. Let G 2 be a 2-edge-colored K 5 using colors 1 and 2 which contains no monochromatic copy of K 3 , i.e., colors 1 and 2 induce two monochromatic copies of C 5 . Suppose that 2i < k − 2 and we have constructed a Gallai-2i-coloring G 2i of K n 2i without a monochromatic copy of K 3 , where n 2i := 5 i . Let G ′ be a 2-edge-colored K 5 using colors 2i+1 and 2i+2 which contains no monochromatic copy of K 3 . Let G 2i+2 = G ′ (5 · G 2i ), i.e., G 2i+2 is a blow-up of G ′ . This way, when k is odd (resp., k is even), we obtain a Gallai-(k −1)-coloring G k−1 of K n k−1 (resp., Gallai-(k −2)-coloring G k−2 of K n k−2 ) without a monochromatic copy of K 3 , where n k−1 = 5 (k−1)/2 (resp., n k−2 = 5 (k−2)/2 ). In the following, we will construct a Gallai-k-coloring G k from G k−1 or G k−2 .
If k is odd, then let A be a monochromatic copy of K m using color k, and let B be a monochromatic copy of K m+1 using color k. Let G k = G k−1 (r · B, (5 (k−1)/2 − r) · A). Then G k is a Gallai-k-coloring of K n with r m+1 3 + 5 (k−1)/2 − r m 3 monochromatic copies of K 3 (here we define 1 3 = 2 3 = 0 for the sake of notation). If k is even, then let C be a 2-edge-coloring (using colors k − 1 and k) of K m with M 2 (K 3 , m) monochromatic copies of K 3 , and let D be a 2-edge-coloring (using colors k − 1 and k) of K m+1 with M 2 (K 3 , m + 1) monochromatic copies of K 3 . Let G k = G k−2 (r · D, (5 (k−2)/2 − r) · C). Then G k is a Gallaik-coloring of K n with rM 2 (K 3 , m + 1) + 5 (k−2)/2 − r M 2 (K 3 , m) monochromatic copies of K 3 . This completes the proof for the upper bound in Theorem 1.4.
It is worth noting that no matter whether k is odd or even, the above extremal coloring is a blow-up of a complete graph of order 5 ⌊(k−1)/2⌋ with a special edge-coloring. Recall that we have g 3 (K 3 , n) = r m+1 3 . An interesting fact is that the above sharpness example for k = 3 is the unique Gallai-3-coloring of K n achieving the minimum number of monochromatic copies of K 3 , which can be derived from a result of [8]. But when k is an even number, the extremal colorings achieving the upper bound are not unique. For example, let F be a 2-edge-coloring (using colors k − 1 and k) of K m+2 with M 2 (K 3 , m + 2) monochromatic copies of K 3 . Since M 2 (K 3 , m) + M 2 (K 3 , m + 2) = 2M 2 (K 3 , m + 1) for any odd number m by Theorem 1.2, we can also construct G k such that G k = G k−2 (1·F, (r−2)·D, (5 (k−2)/2 −r+1)·C). However, it is still a blow-up of a complete graph of order 5 ⌊(k−1)/2⌋ with a special edgecoloring.
Before presenting our proof for the lower bound in Theorem 1.4, we first provide the exact value of g k (K 3 , GR k (K 3 )).
Proof. By the definition of the Gallai-Ramsey number, we have g k (K 3 , GR k (K 3 )) ≥ 1. Moreover, it follows from the above extremal coloring that g k (K 3 , GR k (K 3 )) ≤ 1 if k is odd, and g k (K 3 , GR k (K 3 )) ≤ 2 if k is even. Thus it suffices to prove that g k (K 3 , GR k (K 3 )) ≥ 2 when k is even. We will prove this by induction on k. For k = 2, the statement is trivial since M 2 (K 3 , 6) = 2. We may assume that the statement holds for all even k ′ ≤ k − 2 and we will prove it for k (k ≥ 4).
Let F be a Gallai-k-coloring of K GR k (K 3 ) and suppose (for a contradiction) that F contains only one monochromatic copy of K 3 . Using Theorem 2.1, let V 1 , V 2 , . . . , V t (t ≥ 2) be a Gallai partition of V (F ). We choose such a partition so that t is minimum. We may assume that colors 1 and 2 are the two colors used between these parts. Let R be a 2-edge-coloring of K t with V (R) = {v 1 , v 2 , . . . , v t } and c(v i v j ) = c(V i , V j ) for any 1 ≤ i < j ≤ t. Since M 2 (K 3 , 6) = 2, we have t ≤ 5; otherwise F contains at least two monochromatic copies of K 3 . If 2 ≤ t ≤ 3, then we may assume that t = 2 by the minimality of t (since every graph admitting a Gallai partition with three parts also admits a Gallai partition with two parts). Without loss of generality, let c(V 1 , V 2 ) = 1 and |V 1 | ≥ |V 2 |. First, assume 1 / ∈ C(V 1 ). Then F [V 1 ] is a Gallai-(k − 1)-coloring. Note that |V 1 | ≥ |V (F )|/2 ≥ (5 k/2 + 1)/2 > 2 · 5 (k−2)/2 + 2. Since k is even, we have GR k−1 (K 3 ) = 2 · 5 (k−2)/2 + 1. Thus there is a monochromatic copy of K 3 in F [V 1 ]. Let v be a vertex of this K 3 . Since |V 1 \ {v}| ≥ 2 · 5 (k−2)/2 + 1, there is a monochromatic copy of K 3 in F [V 1 \ {v}]. So there exist two monochromatic copies of K 3 in F [V 1 ], a contradiction. We conclude that 1 ∈ C(V 1 ). In order to avoid two monochromatic copies of K 3 , we have |V 2 | = 1 and there is at most one edge with color 1 in Then there exist two monochromatic copies of K 3 in F , another contradiction. This solves the case 2 ≤ t ≤ 3.
If t = 4, then we first suppose that R contains a monochromatic copy of K 3 , say c( Gallai partition with exactly two parts, contradicting the minimality of t. Thus c(V 4 , V i ) = 1 for some i ∈ {1, 2, 3}. But then c(V i , V (G) \ V i ) = 1, contradicting the minimality of t. Therefore, R is one of the two 2-edge-colorings of K 4 without a monochromatic copy of K 3 , that is, each color induces a path of length three, or one color induces a cycle of length four and the other color induces a matching with two edges. In both cases we can derive that there is at most one edge with color 1 or 2 in 4 j=1 F [V j ]. By the induction hypothesis, we The remaining case is t = 5. Then there is no edge with color 1 or 2 in 5 j=1 F [V j ]; otherwise F contains a 2-edge-coloring of K 6 which contains at least two monochromatic copies of K 3 . Thus we have |V (F )| ≤ 5(GR k−2 (K 3 ) − 1) < GR k (K 3 ) by the induction hypothesis, a contradiction. This completes the proof of Theorem 4.1.
Now we have all ingredients to present our proof for the lower bound in Theorem 1.4. Let s 0 = 1 if k is odd, and s 0 = 2 if k is even. By Theorem 4.1, we have g k (K 3 , GR k (K 3 )) = s 0 . This implies that if v 1 , v 2 , . . . , v GR k (K 3 ) are any GR k (K 3 ) vertices of K n , then K n [{v 1 , v 2 , . . . , v GR k (K 3 ) }] contains at least s 0 monochromatic copies of K 3 . Since each monochromatic copy of K 3 is contained in monochromatic copies of K 3 in any Gallai-k-coloring of K n . This completes the proof of Theorem 1.4.
We obtain the following corollary.
Proof. The upper bound follows from Theorem 1.4. For the proof of the lower bound, we will use induction on t. The case t = 0 follows from Theorem 4.1. We may assume that g k (K 3 , GR k (K 3 ) + (t − 1)) = (t − 1) + 1 = t holds and we will prove it for t (1 ≤ t ≤ 5 (k−1)/2 − 1). Let n = GR k (K 3 ) + t. Note that each monochromatic copy of K 3 is contained in n−3 n−1−3 = n − 3 distinct copies of K n−1 , and there are n n−1 = n distinct copies of K n−1 in K n . By the induction hypothesis, there are at least ⌈tn/(n − 3)⌉ = t + 1 monochromatic copies of K 3 in any Gallai-k-coloring of K n . 11
if s is even and k − s is even, 2 · 17 s/2 · 5 (k−s−1)/2 + 1, if s is even and k − s is odd, if s is odd and k − s is even.
Proof. For convenience, let if s is odd and k − s is even.
We first prove GR k (s · K 4 + e, (k − s) · K 3 ) > g(k, s) by construction. Let G 0 be a single vertex and G 1 be a monochromatic copy of K 4 using color 1. If s is even, then we will begin with G 0 and iteratively construct Gallai-colored graphs. If s is odd, then we will begin with G 1 and iteratively construct Gallai-colored graphs. Suppose we have constructed G i for some i < k. Let G ′ be a 2-edge-colored K 5 using colors i + 1 and i + 2 which contains no monochromatic copy of K 3 , and G ′′ be a 2-edge-colored K 17 using colors i + 1 and i + 2 which contains no monochromatic copy of K 4 . We construct G i+2 or G i+1 based on the following rules: (1) If i ≤ s − 2, then we construct G i+2 such that G i+2 = G ′′ (17 · G i ).
(3) If i = k − 1, then we construct G i+1 by connecting two copies of G i with edges using color k.
Finally, we obtain a g(k, s)-vertex Gallai-k-colored graph G k containing neither a monochromatic copy of K 4 + e in any of the first s colors nor a monochromatic copy of K 3 in any of the last k − s colors. In the following, we will prove GR k (s · K 4 + e, (k − s) · K 3 ) ≤ g(k, s) + 1 by induction on k + s. The case k = 1 is trivial, the case k = 2 follows from Theorem 2.3, and the case s = 0 follows from Theorem 2.2. So we may assume that the result holds for all k ′ + s ′ < k + s and we will prove it for k + s, where k ≥ 3 and 1 ≤ s ≤ k.
Let G be a Gallai-k-coloring of K n , where n = g(k, s) + 1. For a contradiction, suppose that G contains neither a monochromatic copy of K 4 + e in any of the first s colors nor a monochromatic copy of K 3 in any of the last k − s colors. By Theorem 2.1, let V 1 , V 2 , . . . , V t (t ≥ 2) be a Gallai partition of V (G). We choose such a partition so that t is minimum. We may assume that red and blue are the two colors used between these parts, where red and blue are two of the k colors. Note that n = g(k, s) + 1 ≥ 21 since k ≥ 3 and 1 ≤ s ≤ k. Proof. If t = 3, then at least two of the colors c(V 1 , V 2 ), c(V 1 , V 3 ) and c(V 2 , V 3 ) are the same color, say c(V 1 , V 2 ) = c(V 1 , V 3 ). This implies that V 1 and V (G) \ V 1 form a Gallai partition with exactly two parts, contradicting the minimality of t. Hence, t = 2, and we may assume that c(V 1 , V 2 ) is red without loss of generality.
If there is no red edge within both V 1 and V 2 , then G[V 1 ] and G[V 2 ] are two Gallai-(k − 1)colorings. By the induction hypothesis, if red is one of the first s colors, then we have if s − 1 is even (s is odd) and k − s is even, 2 · 2 · 17 (s−1)/2 · 5 (k−s−1)/2 , if s − 1 is even (s is odd) and k − s is odd, 2 · 8 · 17 (s−2)/2 · 5 (k−s−1)/2 , if s − 1 is odd (s is even) and k − s is odd, 2 · 4 · 17 (s−2)/2 · 5 (k−s)/2 , if s − 1 is odd (s is even) and k − s is even a contradiction. If red is one of the last k − s colors, then we have Thus we may assume that G[V 1 ] contains a red edge, so red is one of the first s colors. In order to avoid a red copy of K 4 + e, there is no red edge within V 2 and there is no red copy of K 3 within V 1 (recall that n ≥ 21). By the induction hypothesis, we have if s is even and k − s is even, 4 · 17 (s−2)/2 · 5 (k−s+1)/2 + 8 · 17 (s−2)/2 · 5 (k−s−1)/2 , if s is even and k − s is odd, if s is odd and k − s is even a contradiction. This completes the proof of Claim 5.2.
We define R to be a 2-edge-coloring of K t with V (R) = {v 1 , v 2 , . . . , v t } and c(v i v j ) = c(V i , V j ) for any 1 ≤ i < j ≤ t. Note that if R contains a 2-edge-colored subgraph H, then G also contains a copy of H (in fact, G contains a blow-up of H). both red and blue are among the last k − s colors, then R contains no monochromatic copy of K 3 . So t ≤ R(K 3 , K 3 ) − 1 = 5. Moreover, for every i ∈ [t], since d r i ≥ 1 and d b i ≥ 1, there is no red edge and no blue edge within V i in G. By the induction hypothesis, we have  (1) For any i ∈ R (resp., i ∈ B), we have that v i is not contained in any red copy of K 3 (resp., blue copy of K 3 ) in R.
(2) For any i, j ∈ R (resp., i, j ∈ B) with i = j, we have that c(V i , V j ) is blue (resp., red).
contains neither a red copy of K 3 nor a blue copy of K 3 .
Proof. By the symmetry of red and blue, we will only prove the red case for (1)- (5). Note that if red is one of the last k − s colors, then Fact 5.3 holds clearly. So we may assume that red is one of the first s colors.
(1) If there exists an i ∈ R such that v i is contained in a red copy of K 3 in R, say v i v j v ℓ , then in order to avoid a red copy of K 4 + e, we have that c( is blue. By the minimality of t, we have t = 2, contradicting Claim 5.2. (2) If there exist some i, j ∈ R with i = j such that c(V i , V j ) is red, then for avoiding a red copy of K 4 + e, we have that c(V i ∪ V j , V (G) \ (V i ∪ V j )) is blue. By the minimality of t, we have t = 2, contradicting Claim 5.2.
(3) If there exists an i ∈ R such that d r i ≥ 4, then {v j : j ∈ N r i } forms a blue copy of K d r i by (1). In order to avoid a blue copy of K 4 + e, we have d r i = 4 and c( j∈N r i V j , ℓ∈[t]\N r i V ℓ ) is red. By the minimality of t, we have t = 2, contradicting Claim 5.2.
(4) Suppose d r i ≥ 9 for some i ∈ [t]. In order to avoid a red copy of K 4 + e, there is no red copy of K 3 in R[{v j : j ∈ N r i }]. Since R(K 3 , K 4 + e) = 9, there is a blue copy of K 4 + e (and thus a blue copy of K 3 ), a contradiction.
(5) Suppose that G[V i ] contains a red copy of K 3 for some i ∈ [t]. Since d r i ≥ 1, we may assume that c(V i , V j ) is red for some j ∈ [t] \ {i}. In order to avoid a red copy of K 4 + e, we have that c(V i ∪ V j , V (G) \ (V i ∪ V j )) is blue. By the minimality of t, we have t = 2, contradicting Claim 5.2.
We divide the rest of the proof into two cases according to where red and blue are in the list of colors. Case 1. Red is among the first s colors and blue is among the last k − s colors.
Case 2. Both red and blue are among the first s colors.

Concluding remarks
In Section 3, we studied the maximum number (denoted by f k (n, H)) of edges that are not contained in any rainbow triangle or monochromatic copy of H. There we showed that f k (n, H) ≥ t(n, GR k−1 (H ) − 1), where H is the set of homomorphic copies of H. Let f ′ k (n, H) be the maximum number of edges not contained in any monochromatic copy of H over all Gallai-k-colorings of K n . Then we clearly have f ′ k (n, H) ≤ f k (n, H). Using the sharpness example constructed in the proof of Lemma 3.2 (2), we can also show that H). An interesting and natural question is for which graphs H the equality f ′ k (n, H) = f k (n, H) holds.
Another problem related to Section 3 is to determine the maximum number nim k (n, H) of edges not contained in any monochromatic copy of H over all k-edge-colorings of K n . As remarked in [29], if the Erdős-Sós conjecture holds for a tree T (i.e., ex(n, T ) ≤ (|V (T )| − 2)n/2), then for each n ≥ k 2 (|V (T )| − 1) 2 with (|V (T )| − 1) | n, we have nim k (n, T ) ≥ (k − 1)ex(n, T ). In fact, when T is a star, we can prove the above statement for all n ≥ k 2 (|V (T )| − 1) 2 . Let H be an n-vertex K 1,h -free graph with ex(n, K 1,h ) edges. Note that the maximum degree of H is at most h − 1. For every i ∈ [k − 1], let f i : V (H) → [n] be an arbitrary bijection and let H i be the graph obtained by mapping H on [n] via f i . Let H * be the graph with vertex set [n] and edge set i∈[k−1] E(H i ). Note that ∆(H * ) ≤ (k − 1)(h − 1). For any vertex u, there is a vertex v that is at distance at least three from u in H * since n > ∆(H * ) 2 + 1. If there is an edge e incident with u or v such that e ∈ E(H i ) ∩ E(H j ) for some 1 ≤ i = j ≤ k − 1, then after switching u and v in f i , we claim that there is no edge e ′ incident with u or v satisfying e ′ ∈ E(H i ) ∩ E(H ℓ ) for any ℓ ∈ [k − 1] \ {i}. Otherwise, suppose that there is an edge vw ∈ E(H i ) ∩ E(H ℓ ) after switching u and v in f i . This implies that before switching u and v in f i , we have vw ∈ E(H ℓ ) and uw ∈ E(H i ). Thus uwv is a path of length two in H * , contradicting the fact that v is at distance at least three from u. Thus we can repeat this process to obtain a graph with no edge e such that e ∈ E(H i ) ∩ E(H j ) for some 1 ≤ i = j ≤ k − 1. Hence, we can color K n with c(e) = i if e ∈ E(H i ) for each i ∈ [k − 1] and c(e) = k otherwise. Thus nim k (n, K 1,h ) ≥ i∈[k−1] |E(H i )| = (k − 1)ex(n, K 1,h ).
In Section 4, we studied the minimum number of copies of H over all Gallai-k-colorings of K n . Given an arbitrary k-edge-coloring G of K n , let r k (K 3 , n) and m k (H, n) be the number of rainbow triangles and monochromatic copies of H in G, respectively. It is interesting to consider the behavior of r k (K 3 , n) + m k (H, n). Clearly if k ≤ 2, then r k (K 3 , n) + m k (H, n) = m k (H, n), and if G is rainbow, then r k (K 3 , n) + m k (H, n) = n 3 . However, the general behavior of r k (K 3 , n) + m k (H, n) seems difficult to determine.
Note. We recently discovered that Theorem 1.7 has been proved by Su and Liu [32] and Zhao and Wei [35] independently.