distance: Compute the distance between permutations

View source: R/PerMallows.R

distanceR Documentation

Compute the distance between permutations

Description

Compute the distance between two given permutations. If only one permutation is given the other one is assumed to be the identity (1,2,3,....,n) The distance can be kendall, cayley, hamming and ulam

Usage

distance(
  perm1,
  perm2 = identity.permutation(length(perm1)),
  dist.name = "kendall"
)

Arguments

perm1

a permutation

perm2

optional a permutation

dist.name

optional. One of: kendall (default), cayley, hamming, ulam

Value

The distance between the permutations

Examples

distance(c(1,2,3,5,4))
distance(c(1,2,3,5,4), c(1,2,3,5,4))
distance(c(1,2,3,5,4), c(1,4,2,3,5), "cayley")

PerMallows documentation built on April 3, 2025, 11:09 p.m.