makeKNNgraph {dimRed} | R Documentation

## makeKNNgraph

### Description

Create a K-nearest neighbor graph from data x. Uses `nn2` as a fast way to find the neares neighbors.

### Usage

    makeKNNgraph(x, k, eps = 0, diag = FALSE)

### Arguments

`x` | data, a matrix, observations in rows, dimensions in columns
`k` | the number of nearest neighbors.
`eps` | number, if `eps > 0` the KNN search is approximate, see `nn2`
`diag` | logical, if `TRUE` every edge of the returned graph will have an edge with weight `0` to itself.

### Value

an object of type `igraph` with edge weight being the distances.

[Package dimRed version 0.2.2 Index]