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.