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

Share:

Description

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

Usage

1
2
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

Details

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

Value

g

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

Note

This command relies on the cluster library

Author(s)

Mark Culp

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