Skip to content
Advertisement

Tag: minimization

Algorithm for ordering data so that neighbor elements are as identical as possible

I have a (potentially large) list data of 3-tuples of small non-negative integers, like I want to order the tuples within data so that neighboring tuples (data[i] and data[i+1]) are “as similar as possible”. Define the dissimilarity of two 3-tuples as the number of elements which are unequal between them. E.g. (0, 1, 2) vs. (0, 1, 2): Dissimilarity 0.

Advertisement