View source: R/build_knn_graph.R
build_knn_graph | R Documentation |
Build kNN graph either from distance (from == "dist") or from coordinates (from == "coordinates")
build_knn_graph(
X,
k = 5,
from = c("dist", "coordinates"),
use.nn2 = TRUE,
return_neighbors_order = FALSE,
dist_method = "euclidean",
cor_method = "pearson",
p = 2,
directed = FALSE,
DoSNN = FALSE,
which.snn = c("bluster", "dbscan"),
pruning = NULL,
kmin = 0,
...
)
X |
either distance or matrix of coordinates (rows are samples and cols are coordinates) |
k |
kNN parameter |
from |
from which data type to build kNN network: "dist" if X is a distance (dissimilarity) or "coordinates" if X is a matrix with coordinates as cols and cells as rows |
use.nn2 |
whether use nn2 method to buid kNN network faster (available only for "coordinates" option) |
return_neighbors_order |
whether return order of neighbors (not available for nn2 option) |
dist_method |
method to compute dist (if X is a matrix of coordinates) available: c("cor", "euclidean", "maximum", "manhattan", "canberra", "binary", "minkowski") |
cor_method |
if distance is computed as correlation (dist_method == "cor), which type of correlation to use (available: "pearson", "kendall", "spearman") |
p |
p param in |
directed |
whether to build a directed graph |
DoSNN |
whether to apply shared nearest neighbors (default is |
which.snn |
whether to use neighborsToSNNGraph or sNN for sNN graph construction |
pruning |
quantile to perform edge pruning (default is |
kmin |
keep at least |
... |
other parameters of neighborsToSNNGraph or sNN |
a list with components
graph.knn - igraph object
order - Nxk matrix with indices of k nearest neighbors ordered by relevance (from 1st to k-th)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.