R/get.neighbors.R

Defines functions get.neighbors

Documented in get.neighbors

#' Neighbors of an agent in a network
#'
#' @description Presents all neighbors of a given node.
#' @param net	 The input network.
#' @param NodeID The ID of the input node.
#' @details Neighbors of a node are nodes that directly connects to this node.
#' @return A vector.
#' @author Xu Dong
#' @examples \dontrun{
#' x <-  net.ring.lattice(12,4)
#' get.neighbors(x,2)}
#' @export

get.neighbors <- function(net,NodeID) {
  net[[NodeID]]
}

Try the fastnet package in your browser

Any scripts or data that you put into this service are public.

fastnet documentation built on Jan. 13, 2021, 5:28 p.m.