===============================================================So far I am using the following function swapdist, which is based on fact, that the swap distance corresponds to the number of exchanges in a bubblesort.