You asked me to leave an answer. I'm not entirely sure what you're looking for, though. You should visit the help page for allShortestPaths
. It looks pretty straightforward to use the function, which can take in a square matrix and find the shorest paths.
the code for allShortestPaths
in the package e1071
is as follows
function (x)
{
x <- as.matrix(x)
x[is.na(x)] <- .Machine$double.xmax
x[is.infinite(x) & x > 0] <- .Machine$double.xmax
if (ncol(x) != nrow(x))
stop("x is not a square matrix")
n <- ncol(x)
z <- .C("e1071_floyd", as.integer(n), double(n^2), as.double(x),
integer(n^2), PACKAGE = "e1071")
z <- list(length = matrix(z[[2]], n), middlePoints = matrix(z[[4]] +
1, n))
z$length[z$length == .Machine$double.xmax] <- NA
z
}
<environment: namespace:e1071>
for more information, check out the help page.