View source: R/10-grafos-TSP.R
compute_distance_matrix | R Documentation |
p
-distance matrix computationIt computes the distance matrix of a set of n
two-dimensional points given by a n\times 2
matrix using
the distance-p
with p=2
by default.
compute_distance_matrix(z, p = 2)
z |
A |
p |
The |
Given a set of n
points \{z_j\}_{j=1,...,n}
, the
distance matrix is a n\times n
symmetric matrix with
matrix elements
d_{ij} = d(z_i,z_j)
computed using the
distance-p
given by
d_p(x,y) = \left(\sum_i
(x_i-y_i)^p\right)^{\frac{1}{p}}
.
The distance-p
of the points.
Cesar Asensio
compute_p_distance computes the distance-p
,
compute_tour_distance computes tour distances. A distance
matrix can also be computed using dist.
set.seed(1)
n <- 25
z <- cbind(runif(n,min=1,max=10),runif(n,min=1,max=10))
d <- compute_distance_matrix(z)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.