R/neighbour_index.R

Defines functions neighbour_index

Documented in neighbour_index

#'  Index neighbours
#'
#' Indices of neighbours for each gene
#' @param W matrix; symmetrically normalized adjacency matrix W = D^-1 A D^-1, see 'normalize_adj_mat' function
#' @return list with indices of neighbours for each gene
#'
#' @export
#'

neighbour_index <- function(W=NULL){

  ind_adj <- apply(W, 1, FUN=function(x) which(x>0, arr.ind = T))
  
  return(ind_adj)
}
emosca-cnr/mND documentation built on April 11, 2024, 12:49 p.m.