Uses the path.matrix to obtain the shortest paths of the quickfechner object.

getpath(fm, pm = NULL, from = 1, to = nrow(fm))

Arguments

fm

A Fechner matrix computed via quickfechner

pm

The path.matrix. Only necessary if the corresponding attribute in fm is missing.

from

Start index.

to

Final index.

Details

The path.matrix is defined as follows: The entry of the i-th row and j-th column is the index of the last node visited before j on the shortest path from i to j.

Value

A vector of indices defining the shortest path from i to j in the original matrix passed to the quickfechner function.

Examples

#not a distance matrix, but a similarity matrix in some sense cx <- 1-abs(cor(olives[-c(1,2,11)])) cx2 <- quickfechner(cx) getpath(cx2,from=1,to=5)
#> [1] 1 4 5