Learn R Programming

spa (version 2.0)

knnGraph: Convert a data matrix to a K-NN graph or epsilon graph

Description

These functions are designed to convert data sets or distance matrices to graphs.

Usage

knnGraph(x, k = 5, weighted = TRUE, dist = FALSE, ...) epsGraph(x, eps = 0.2, weighted = TRUE, dist=FALSE, ...)

Arguments

x
the data matrix, if dist=TRUE then x is a distance matrix
k
the number of neighbors for a knn graph
eps
size of fixed radius
weighted
if TRUE the graph will be weighted. Note if TRUE use floyd for shortest path distance otherwise use fastDist.
dist
when dist=TRUE then x is a distance matrix
...
Extra parameters for the daisy(...) method

Value

g
A graph made from data x or distance matrix as input.

Details

The daisy function in cluster library is used primarily due to its speed and reliability.

References

M. Culp (2011). spa: A Semi-Supervised R Package for Semi-Parametric Graph-Based Estimation. Journal of Statistical Software, 40(10), 1-29. URL http://www.jstatsoft.org/v40/i10/.

See Also

spa knnGraph epsGraph