Linear Time Algorithms for Happy Vertex Coloring Problems for Trees
Given an undirected graph \(G = (V, E)\) with \(|V| = n\) and a vertex coloring, a vertex v is happy if v and all its neighbors have the same color. An edge is happy if its end vertices have the same color. Given a partial coloring of the vertices of the graph using k colors, the Maximum Happy Vertices (also called k-MHV) problem asks to color the remaining vertices such that the number of happy vertices is maximized. The Maximum Happy Edges (also called k-MHE) problem asks to color the remaining vertices such that the number of happy edges is maximized. For arbitrary graphs, k-MHV and k-MHE are NP-Hard for \(k \ge 3\). In this paper we study these problems for trees. For a fixed k we present linear time algorithms for both the problems. In general, for any k the proposed algorithms take \(O(nk \log k)\) and O(nk) time respectively.
KeywordsHappy vertex Happy edge Graph coloring Coloring trees
We thank the anonymous reviewers for their detailed reviews and suggestions.
- 2.Dahlhaus, E., Johnson, D.S., Papadimitriou, C.H., Seymour, P.D., Yannakakis, M.: The complexity of multiway cuts (extended abstract). In: Proceedings of the Twenty-fourth Annual ACM Symposium on Theory of Computing, STOC 1992, pp. 241–251 (1992)Google Scholar