An Erdős-Gallai type theorem for vertex colored graphs

While investigating odd-cycle free hypergraphs, Győri and Lemons introduced a colored version of the classical theorem of Erdős and Gallai on $$P_k$$Pk-free graphs. They proved that any graph G with a proper vertex coloring and no path of length $$2k+1$$2k+1 with end vertices of different colors has at most 2kn edges. We show that Erdős and Gallai’s original sharp upper bound of kn holds for their problem as well. We also introduce a version of this problem for trees and present a generalization of the Erdős-Sós conjecture.

We denote by P ℓ the path of length ℓ (that is, containing ℓ edges). For a graph G, we denote by E(G) and V (G) the edge and vertex set of G, respectively. We begin by recalling the theorems of Erdős and Gallai about graphs without long paths and cycles.
Theorem 1 (Erdős-Gallai [3]). Let G be an n-vertex graph with no P ℓ , then and equality holds if and only if ℓ divides n and G is the disjoint union of n ℓ cliques of size ℓ.
Theorem 2 (Erdős-Gallai [3]). Let G be an n-vertex graph with no C m for all m ≥ ℓ, then and equality holds if and only if ℓ − 2 divides n − 1 and G is the union of n−1 ℓ−2 disjoint cliques of size ℓ − 1 sharing a fixed vertex.
In fact, Theorem 1 was deduced as a simple corollary of Theorem 2. In a more recent paper, Győri and Lemons [5] investigated the extremal number of hypergraphs avoiding so-called Bergecycles. To this end, they introduced a generalization of the theorem of Erdős and Gallai about paths. By a proper vertex coloring of a graph G, we mean a coloring of the vertices of G such that no two adjacent vertices are the same color. Győri and Lemons proved the following.
Theorem 3 (Győri-Lemons 2). Let G be an n-vertex graph with a proper vertex coloring such that G contains no P 2k+1 with endpoints of different colors, then We show that the factor of 2 in Theorem 3 is not needed and, thus, recover the original upper bound from the Erdős-Gallai theorem. We also determine which graphs achieve this upper bound.
Theorem 4. Let G be an n-vertex graph with a proper vertex coloring such that G contains no P 2k+1 with endpoints of different colors, then |E(G)| ≤ kn, and equality holds if and only if 2k + 1 divides n and G is the union of n 2k+1 disjoint cliques of size 2k + 1.
Proof of Theorem 4. By induction on the number of vertices, we may assume that G is connected and has minimum degree If G is C ℓ -free for all ℓ ≥ 2k + 1, then by Theorem 2 we have Thus, assume there is a cycle of length at least 2k + 1, and let C be the smallest such cycle with length ℓ. Let the vertices of C be v 0 , v 1 , v 2 , . . . , v ℓ−1 , v 0 , consecutively. Addition and subtraction in subscripts will always be taken modulo ℓ. We say that an edge e is outgoing if it has one vertex in V (C) and the other in V (G) \ V (C). We say a vertex v ∈ V (C) is outgoing if it is contained in an outgoing edge. Case 1.
Suppose ℓ ≥ 2k + 4. Since we have chosen ℓ to be the length of the smallest C ℓ with ℓ ≥ 2k + 1, we have that v 0 cannot be adjacent to any of v 2 , v 3 , . . . , v ℓ−2k nor any of v 2k , v 2k+1 , . . . , v ℓ−2 , for otherwise we would have a shorter cycle of length at least 2k + 1. Also note that v 0 is adjacent to v 1 and v ℓ−1 .
Observe that v 0 cannot have two consecutive neighbors in the ℓ-cycle. Indeed, if v i and v i+1 are neighbors of v 0 , then we have the following (2k + 1)-paths starting at and v 2k+2 would have to be the same color, but this is impossible since they are neighbors.
If v 0 has a neighbor outside of C, say u 0 , then we have two paths of length 2k+1: It follows that u 0 and v ℓ−1 have the same color. Similarly, u 0 and v 1 have the same color. Thus, v ℓ−1 and v 1 also have the same color, and similarly, for every i such that v i is outgoing, we can conclude v i−1 and v i+1 have the same color.
If ℓ = 2k + 4 and there is an outgoing vertex, say v 0 , then v 1 and v 2k+3 have the same color (from the previous paragraph), a contradiction since v 1 and v 2k+2 also have the same color (they are endpoints of a length 2k + 1 path along the cycle C). If there is no outgoing vertex in V (C), then C uses all vertices of the graph. Since no vertex of the cycle has two consecutive neighbors, it follows that each degree is bounded by 2 + ⌈ 2k−5 2 ⌉ ≤ k and so the number of edges is at most If ℓ ≥ 4k + 5, we will show that v 0 has an outgoing edge from the ℓ-cycle C. Suppose not, then since v 0 does not have consecutive neighbors, it follows that v 0 has at most neighbors, a contradiction. Thus, v 0 and similarly every other v i has an outgoing neighbor, and it follows that for every i, v i and v i+2 have the same color. Hence v 0 and v 2k have the same color, contradicting that v 0 and v 2k+1 have the same color, since they are endpoints of a P 2k+1 .
, v i is a path of length 2ℓ + 1, and so v i and v i+2 have the same color. Thus, v 0 and v 2k+2 have the same color, but they are adjacent, contradiction. Case 3. Suppose that ℓ = 2k + 2. This is impossible since v 0 , v 1 , . . . , v 2k+1 is a path of length 2k + 1 but v 0 and v 2k+1 are adjacent, contradiction. Case 4. Finally, suppose ℓ = 2k + 1. If no edge is outgoing, then we are done, since by connectivity the total number of edges in the graph is at most 2k+1 2 = kn. If indeed the total number of edges is kn, then G is a clique. This is the only case when equality holds. From here on, we will assume there is an outgoing edge.
Observe that if u is not a vertex of C, then u cannot have two consecutive neighbors in C, for otherwise we would have a cycle of length 2k + 2, and we are done as in Case 3. Moreover, u cannot be connected to v i and v i+3 , since there would be two paths of length 2k + 1 from u to v i+1 and v i+2 . It follows that u can have at most k − 1 neighbors in C and, thus, must have a neighbor outside C.
If there are some two consecutive outgoing vertices in C, then we may take two such vertices v i and v i+1 so that the next vertex v i+2 is outgoing. Suppose {v i+2 , u i+2 } is an outgoing edge. By the previous observation, there is an edge {u i+2 , w i+2 } where w i+2 does not belong to the cycle. It is easy to see that v i and also v i+1 cannot have two consecutive neighbors from C, and so each has degree k. By removing these two vertices, we remove 2k − 1 edges, and by the induction hypothesis the resulting graph has at most k(n − 2) edges. So e(G) < kn.
For every i, either v i+1 or v i+2 is an outgoing vertex. Hence the vertex v i has either the same color as v i+2 , if v i+1 is an outgoing vertex, or the same color as v i+4 , if v i+2 is an outgoing vertex. Hence by repeatedly applying this argument we obtain that v 0 has the same color as v 2k or v 1 , contradiction.
We believe that an analogue of Theorem 3 should hold in the setting of trees. Recall that the extremal number ex(n, H) of a graph H is defined to be the largest number of edges an n-vertex graph may have if it does not contain H as a subgraph. Erdős and Sós made the following famous conjecture about the extremal number of trees.
A proof of Conjecture 1 for sufficiently large trees has been announced by Ajtai, Komlós, Simonovits and Szemerédi [1].
We introduce a new variation of the extremal function ex(n, T ) in the case of trees. Let ex c (n, T ) denote the maximimum number of edges possible in an n-vertex graph G with a proper vertex coloring (using any number of edges), such that in every copy of T in G the leaves of T are all the same color.
Theorem 5. Let T be a tree with k edges such that in the (unique) proper vertex 2-coloring of T all leaves are not the same color, then ex c (n, T ) ≤ (k − 1)n.
Proof. There is a path of odd length in T with endpoints which are leaves. Let G be an n-vertex graph with more than (k − 1)n edges with a proper vertex coloring. We may find a subgraph G ′ of G with average degree at least that of G and minimum degree greater than k − 1. The proper coloring of G induces a proper coloring of G ′ and so applying Theorem 3 we may find a copy of P 2ℓ+1 in G ′ with endpoints of distinct colors. We may now build up the rest of the tree in a greedy fashion as every degree in G ′ is at least k and T has k + 1 vertices. Thus, we have found a copy of T in the graph G with leaves of at least two colors. Theorem 6. Let T be a tree with k edges such that in the proper vertex 2-coloring of T all leaves are the same color, then ex c (n, T ) = n 2 4 , provided n is sufficiently large.
Proof. The fact that all leaves are colored the same by a 2-coloring implies that all paths between a pair of leaves have even length. We add an edge e to T connecting an arbitrary pair of leaves, and let G be the resulting graph. Since G has an odd cycle, its chromatic number is clearly 3, and the deletion of e yields a 2-chromatic graph (so G is edge-critical). It follows from a theorem of Simonovits [7] that if n is sufficiently large, the extremal number of G is precisely ex(n, G) = n 2 4 . Thus, in any n-vertex graph with more than n 2 4 edges we have a copy T with two adjacent leaves, and so in any proper coloring of this graph we have a copy of T with leaves of at least 2 colors. It follows that ex c (n, T ) ≤ n 2 4 , and this bound is realized by the complete bipartite graph K ⌊ n 2 ⌋,⌈ n 2 ⌉ . Remark 1. The paths of even length P 2k are a special case of Theorem 6. Here better bounds on n are known to exist. For example, the result of Füredi [4] on the extremal number of odd cycles implies that n ≥ 4k is sufficient.
We believe that a strengthening of Conjecture 1 should hold for trees whose 2-coloring yields two leaves of different colors. One would hope that Conjecture 2 could be deduced directly from Conjecture 1, but unfortunately this does not seem to be the case. We take a first step towards Conjecture 2 by proving it in the case of double stars. Proof. Let G be a vertex colored graph with |E(G)| > |V (G)| a+b 2 . Without loss of generality, suppose a ≤ b. We may assume by induction that δ(G) > a+b 2 ≥ a. Since ex(m, S a,b ) = m a+b 2 (see, for example [6]), it follows that G contains a copy of S a,b . Suppose this copy is defined by the edge {u, v} together with the disjoint sets A ⊆ N (u), B ⊆ N (v) with |A|= a, |B|= b. Now, if there is more than one color in A ∪ B, then we are done. So suppose the color of all vertices in A ∪ B is the same. Hence A ∪ B is an independent set.
If u is not adjacent to some w ∈ B (See Figure 2, middle), since |N (w)| ≥ a + 1, we can pick C ⊆ N (w) \ {u, v} of size a. So the edge {v, w} together with the sets B ′ = (B ∪ {u})\{w} and C define a S a,b where the colors of all vertices in C are different from the colors of B ′ \{u}.
If u is adjacent to all w ∈ B, then fix x ∈ B (See Figure 2, right). Since |N (x)| ≥ a + 1, we can pick C ⊆ N (x) \ {u} of size a. Let y ∈ A and define B ′ = (B ∪ {y})\{x}. Observe that B ′ ⊆ N (u), and the edge {u, x} together with the sets B ′ and C defines a S a,b , where again the color of the vertices in C is different from the color of vertices in B ′ .