View source: R/10-grafos-TSP.R
plot_tour | R Documentation |
Plotting tours constructed by tour-building routines for TSP
plot_tour(z, h, ...)
z |
Set of points of a TSP |
h |
List with $tour and $distance components returned from a TSP tour building algorithm |
... |
Parameters to be passed to plot |
It plots the two-dimensional cities of a TSP and a tour among them for visualization purposes. No aesthetically appealing effort has been invested in this function.
This function is called by its side effect.
Cesar Asensio
build_tour_nn nearest neighbor heuristic with a single starting point, build_tour_nn_best repeats the previous algorithm with all possible starting points, compute_distance_matrix computes the distance matrix of a set of two-dimensional points.
set.seed(1)
n <- 25
z <- cbind(runif(n,min=1,max=10),runif(n,min=1,max=10))
d <- compute_distance_matrix(z)
b <- build_tour_nn_best(d, n)
plot_tour(z,b)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.