Convex recolorings of strings and trees: Definitions, hardness results and algorithms

Shlomo Moran, Sagi Snir

Research output: Contribution to journalConference articlepeer-review


A coloring of a tree is convex if the vertices that pertain to any color induce a connected subtree. Convex colorings of trees arise in areas such as phylogenetics, linguistics, etc. e.g., a perfect phylogenetic tree is one in which the states of each character induce a convex coloring of the tree. When a coloring of a tree is not convex, it is desirable to know "how far" it is from a convex one, and what are the convex colorings which are "closest" to it. In this paper we study a natural definition of this distance - the recoloring distance, which is the minimal number of color changes at the vertices needed to make the coloring convex. We show that finding this distance is NP-hard even for a path, and for some other interesting variants of the problem. In the positive side, we present algorithms for computing the recoloring distance under some natural generalizations of this concept: the uniform weighted model and the non-uniform model. Our first algorithms find optimal convex recolorings of strings and bounded degree trees under the non-uniform model in linear time for any fixed number of colors. Next we improve these algorithms for the uniform model to run in linear time for any fixed number of bad colors. Finally, we generalize the above result to hold for trees of unbounded degree.

Original languageEnglish
Pages (from-to)218-232
Number of pages15
JournalLecture Notes in Computer Science
StatePublished - 2005
Externally publishedYes
Event9th International Workshop on Algorithms and Data Structures, WADS 2005 - Waterloo, Canada
Duration: 15 Aug 200517 Aug 2005

ASJC Scopus subject areas

  • Theoretical Computer Science
  • General Computer Science


Dive into the research topics of 'Convex recolorings of strings and trees: Definitions, hardness results and algorithms'. Together they form a unique fingerprint.

Cite this