% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mst_knn.R
\name{mst.knn}
\alias{mst.knn}
\title{Performs the MST-kNN clustering algorithm}
\usage{
mst.knn(distance.matrix, suggested.k)
}
\arguments{
\item{distance.matrix}{A numeric matrix or data.frame with equal numbers of
rows and columns representing pairwise distances between objects.}

\item{suggested.k}{Optional. A numeric value representing the suggested
number of nearest neighbours.}
}
\value{
A list with elements \code{cnumber}, \code{cluster},
  \code{partition}, \code{csize}, \code{network}.
}
\description{
Performs the MST-kNN clustering algorithm which generates a
  clustering solution with automatic number-of-clusters determination by
  recursively intersecting the Minimum Spanning Tree (MST) and the
  \emph{k}-Nearest Neighbor (\emph{k}NN) graphs.
}
\examples{

set.seed(1987)
n <- 100; m <- 15
x <- matrix(runif(n * m, min = -5, max = 10), nrow = n, ncol = m)
d <- base::as.matrix(stats::dist(x, method = "euclidean"))
library("mstknnclust")
results <- mst.knn(d)
library("igraph")
plot(results$network,
     vertex.size  = 8,
     vertex.color = igraph::components(results$network)$membership,
     layout       = igraph::layout_with_fr(results$network, niter = 10000),
     main         = paste("MST-kNN  |  clusters =", results$cnumber))

}
\author{
Mario Inostroza-Ponta, Jorge Parraga-Alava, Pablo Moscato
}
