The swap distance (or Cayley distance) between two permutations is the minimum number of exchanges of two elements transforming one into the other. Given three permutations, Swap Median asks for a permutation minimizing the sum of the swap distances to the inputs, and Swap Closest asks for one minimizing the maximum distance. Both problems are NP-hard for an unbounded number of inputs, but the case of three inputs, the smallest non-trivial one, has remained open. We prove that both problems are NP-complete for three permutations. Swap Median remains NP-complete even when two of the inputs differ by disjoint swaps. For Swap Closest, it is already NP-complete to decide whether the trivial lower bound is attained. Along the way, we show that finding a permutation lying on shortest paths from one input to each of the other two, as far as possible from that input, is NP-hard and APX-hard. We also characterize when the triangle-inequality lower bound of the median is attained, and we give a quadratic-time algorithm when cycles are short, which yields a dichotomy. Finally, experiments on simulated evolutionary data show that a simple certified heuristic is optimal on all small instances and recovers ancestral permutations.
翻译:暂无翻译