build_knn_graph: Build kNN network

View source: R/util.r

build_knn_graphR Documentation

Build kNN network

Description

Calculate the kNN-network given a data matrix

Usage

build_knn_graph(
  data,
  k = 20,
  dist_type = c("euclidean", "pearson", "raw"),
  use_seurat_snn = TRUE,
  mutual = TRUE,
  jaccard_weighted = TRUE,
  jaccard_prune = 1/15,
  return_igraph = FALSE,
  verbose = TRUE
)

Arguments

data

The data matrix

k

The number of neighbors

dist_type

The type of distance. Should be one of "euclidean", "pearson" and "raw"

use_seurat_snn

If TRUE, the FindNeighbors function in Seurat will be called to calculate

mutual

Only consider mutual nearest neighbors. Ignore if use_seurat_snn is TRUE

jaccard_weighted

If TRUE, edges of the resulted graph are weighted by Jaccard index. Ignore if use_seurat_snn is TRUE

jaccard_prune

Prune an edge if its weight is smaller than this value. Ignore if use_seurat_snn is FALSE and jaccard_weighted is FALSE

return_igraph

if TRUE, an igraph object instead of the adjacent matrix will be returned

verbose

If TRUE, progress message is provided

Value

A Matrix of kNN network adjacant matrix. If return_igraph is TRUE, the corresponding igraph object is returned


quadbiolab/simspec documentation built on March 8, 2024, 11:59 p.m.