R/neighbor_nms.R

Defines functions neighbor_nms

Documented in neighbor_nms

#' Get names of nodes' neighbors
#'
#' Get node names of nodes' direct neighbors
#'
#' @param nodes Node names in the graph
#' @inheritParams plot_pwy

neighbor_nms <- function(gr, nodes){
  nn <- igraph::V(gr)$name[unlist(igraph::ego(gr, order=1, match(nodes, igraph::V(gr)$name)))]
  nn <- setdiff(nn, nodes)
  return(nn)
}
jdreyf/ezlimmaplot documentation built on Feb. 8, 2025, 2:25 a.m.