Finite metric spaces and their filtered complexes

CayleyMetric
CayleyMetric(g,h,N)
CayleyMetric(g,h)

Inputs two permutations g,h and optionally the degree N of a symmetric group containing them. It returns the minimum number of transpositions needed to express g*h^-1 as a product of transpositions.

HammingMetric
HammingMetric(g,h,N)
HammingMetric(g,h)

Inputs two permutations g,h and optionally the degree N of a symmetric group containing them. It returns the number of integers moved by the permutation g*h^-1.

KendallMetric
KendallMetric(g,h,N)
KendallMetric(g,h)

Inputs two permutations g,h and optionally the degree N of a symmetric group containing them. It returns the minimum number of adjacent transpositions needed to express g*h^-1 as a product of adjacent transpositions. An adjacent transposition has the for (i,i+1).

EuclideanSquaredMetric
EuclideanSquaredMetric(v,w)

Inputs two vectors v,w of equal length and returns the sum of the squares of the components of v-w. In other words, it returns the square of the Euclidean distance between v and w.

EuclideanApproximatedMetric
EuclideanApproximatedMetric(v,w)

Inputs two vectors v,w of equal length and returns a rational approximation to the square root of the sum of the squares of the components of v-w. In other words, it returns an approximation to the Euclidean distance between v and w.

ManhattanMetric
ManhattanMetric(v,w)

Inputs two vectors v,w of equal length and returns the sum of the absolute values of the components of v-w. This is often referred to as the taxi-cab distance between v and w.

VectorsToSymmetricMatrix
VectorsToSymmetricMatrix(L)
VectorsToSymmetricMatrix(L,D)

Inputs a list L of vectors and optionally a metric D. The default is D=ManhattanMetric. It returns the symmetric matrix whose i-j-entry is S[i][j]=D(L[i],L[j]).

SymmetricMatDisplay
SymmetricMatDisplay(S)
SymmetricMatDisplay(L,V)

Inputs an n \times n symmetric matrix S of non-negative integers and an integer t in [0 .. 100]. Optionally it inputs a list V=[V_1, ... , V_k] of disjoint subsets of [1 .. n]. It displays the graph with vertex set [1 .. n] and with an edge between i and j if S[i][j] < t. If the optional list V is input then the vertices in V_i will be given a common colour distinct from other vertices.

SymmetricMatrixToFilteredGraph
SymmetricMatrixToFilteredGraph(S,t,m)

Inputs an integer symmetric matrix S, a positive integer t and a positive integer m. The function returns a filtered graph of filtration length t. The k-th term of the filtration is a graph with one vertex for each row of S. There is an edge in this graph between the i-th and j-th vertices if the entry S[i][j] is less than or equal to k*m/t.

PermGroupToFilteredGraph
PermGroupToFilteredGraph(S,D)

Inputs a permutation group G and a metric D defined on permutations. The function returns a filtered graph. The k-th term of the filtration is a graph with one vertex for each element of the group G. There is an edge in this graph between vertices g and h if D(g,h) is less than some integer threshold t_k. The thresholds t_1 < t_2 < ... < t_N are chosen to form as long a sequence as possible subject to each term of the filtration being a distinct graph.