nearest neighbor, k-nearest neighbor, and mutual k-nearest neighbor
(di)graphs.
Usage
nng(x = NULL, dx = NULL, k = 1, mutual = FALSE, p = 2)
Arguments
x
a data matrix. Either x or dx is required
dx
interpoint distance matrix
k
number of neighbors
mutual
logical. if true the neighbors must be mutual. See details.
p
the value of p in the $L_p$ distance.
Value
an object of class igraph with the extra attributes
layoutthe x vectors.
k,mutual,parguments given to nn.
Details
a k-nearest neighbor graph is a digraph where each vertex is
associated with an observation and there is a directed edge between
the vertex and it's k nearest neighbors. A mutual k-nearest neighbor
graph is a graph where there is an edge between x and y if x is
one of the k nearest neighbors of y AND y is one of the k nearest
neighbors of x.
References
D.J. Marchette, Random Graphs for Statistical Pattern Recognition,
John Wiley & Sons, 2004.