**20**(23): e1

Research Article

# Kendall tau sequence distance: Extending Kendall tau from ranks to sequences

@ARTICLE{10.4108/eai.13-7-2018.163925, author={Vincent A. Cicirello}, title={Kendall tau sequence distance: Extending Kendall tau from ranks to sequences}, journal={EAI Endorsed Transactions on Industrial Networks and Intelligent Systems}, volume={7}, number={23}, publisher={EAI}, journal_a={INIS}, year={2020}, month={4}, keywords={edit distance, Kendall tau, pattern recognition, sequences, similarity, strings}, doi={10.4108/eai.13-7-2018.163925} }

- Vincent A. Cicirello

Year: 2020

Kendall tau sequence distance: Extending Kendall tau from ranks to sequences

INIS

EAI

DOI: 10.4108/eai.13-7-2018.163925

## Abstract

An edit distance is a measure of the minimum cost sequence of edit operations to transform one structure into another. Edit distance can be used as a measure of similarity as part of a pattern recognition system, with lower values of edit distance implying more similar structures. Edit distance is most commonly encountered within the context of strings, where Wagner and Fischer’s string edit distance is perhaps the most well-known. However, edit distance is not limited to strings. For example, there are several edit distance measures for permutations, including Wagner and Fischer’s string edit distance since a permutation is a special case of a string. However, another edit distance for permutations is Kendall tau distance, which is the number of pairwise element inversions. On permutations, Kendall tau distance is equivalent to an edit distance with adjacent swap as the edit operation. A permutation is often used to represent a total ranking over a set of elements. There exist multiple extensions of Kendall tau distance from total rankings (permutations) to partial rankings (i.e., where multiple elements may have the same rank), but none of these are suitable for computing distance between sequences. We set out to explore extending Kendall tau distance in a different direction, namely from the special case of permutations to the more general case of strings or sequences of elements from some finite alphabet. We name our distance metric Kendall tau sequence distance, and define it as the minimum number of adjacent swaps necessary to transform one sequence into the other. We provide two O(n lg n) algorithms for computing it, and experimentally compare their relative performance. We also provide reference implementations of both algorithms in an open source Java library.

Copyright © 2020 Vincent A. Cicirello, licensed to EAI. This is an open access article distributed under the terms of the Creative Commons Attribution license (http://creativecommons.org/licenses/by/3.0/), which permits unlimited use, distribution and reproduction in any medium so long as the original work is properly cited.