order_tsp | R Documentation |
Returns shortest cycle or path via tsp solver from package TSP
order_tsp(d, method = "nearest", cycle=FALSE,improve=FALSE,path_dir = path_cor,...)
d |
A |
method |
Options are |
improve |
if |
cycle |
If |
path_dir |
If a function is provided, used to re-orient the cycle/path. Default function is |
... |
passed to |
Requires package TSP.
When path_dir
is non NULL, the returned hamiltonian is also optimally oriented using best_orientation
, which compares orientations via path_dir
.
A vector containing a permutation of 1..n
C.B. Hurley and R.W. Oldford
See package TSP.
order_best
, solve_TSP
in TSP.
require(PairViz) rdist <- function(n) { d <- matrix(0,n,n) d[lower.tri(d)] <- runif(n*(n-1)/2) return(as.dist(d)) } order_tsp(rdist(7)) edist <- as.dist(as.matrix(eurodist)) order_tsp(edist)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.