diff --git a/R/structural.properties.R b/R/structural.properties.R index 2598fa20c96..8f6e94a0149 100644 --- a/R/structural.properties.R +++ b/R/structural.properties.R @@ -1130,6 +1130,7 @@ ego_size <- function(graph, order = 1, nodes = V(graph), #' #' These functions find the vertices not farther than a given limit from #' another fixed vertex, these are called the neighborhood of the vertex. +#' Note that `ego()` and `neighborhood()` are synonyms, aliases. #' #' The neighborhood of a given order `r` of a vertex `v` includes all #' vertices which are closer to `v` than the order. I.e. order 0 is always @@ -1139,7 +1140,7 @@ ego_size <- function(graph, order = 1, nodes = V(graph), #' `ego_size()` returns the size of the neighborhoods of the given order, #' for each given vertex. #' -#' `ego()` returns the vertices belonging to the neighborhoods of the given +#' `ego()`/`neighborhood()` (synonyms) returns the vertices belonging to the neighborhoods of the given #' order, for each given vertex. #' #' `make_ego_graph()` is creates (sub)graphs from all neighborhoods of @@ -1165,7 +1166,7 @@ ego_size <- function(graph, order = 1, nodes = V(graph), #' @return #' \itemize{ #' \item{`ego_size()` returns with an integer vector.} -#' \item{`ego()` returns A list of `igraph.vs` or a list of numeric +#' \item{`ego()`/`neighborhood()` (synonyms) returns A list of `igraph.vs` or a list of numeric #' vectors depending on the value of `igraph_opt("return.vs.es")`, #' see details for performance characteristics.} #' \item{`make_ego_graph()` returns with a list of graphs.} @@ -1185,6 +1186,10 @@ ego_size <- function(graph, order = 1, nodes = V(graph), #' ego(g, order = 0, 1:3) #' ego(g, order = 1, 1:3) #' ego(g, order = 2, 1:3) +#' # neighborhood() is an alias of ego() +#' neighborhood(g, order = 0, 1:3) +#' neighborhood(g, order = 1, 1:3) +#' neighborhood(g, order = 2, 1:3) #' #' # attributes are preserved #' V(g)$name <- c("a", "b", "c", "d", "e", "f", "g", "h", "i", "j") @@ -1220,6 +1225,9 @@ ego <- function(graph, order = 1, nodes = V(graph), res } +#' @export +#' @rdname ego +neighborhood <- ego #' @rdname ego #' @family structural.properties #' @export diff --git a/R/zzz-deprecate.R b/R/zzz-deprecate.R index 98ef6e532cc..76ff583d58e 100644 --- a/R/zzz-deprecate.R +++ b/R/zzz-deprecate.R @@ -447,8 +447,6 @@ deprecated("mod.matrix", modularity_matrix) #' @export multilevel.community deprecated("multilevel.community", cluster_louvain) -#' @export neighborhood -deprecated("neighborhood", ego) #' @export neighborhood.size deprecated("neighborhood.size", ego_size) #' @export no.clusters diff --git a/man/ego.Rd b/man/ego.Rd index c84294c1ab5..adc0eabb391 100644 --- a/man/ego.Rd +++ b/man/ego.Rd @@ -30,6 +30,14 @@ ego( mindist = 0 ) +neighborhood( + graph, + order = 1, + nodes = V(graph), + mode = c("all", "out", "in"), + mindist = 0 +) + make_ego_graph( graph, order = 1, @@ -58,7 +66,7 @@ argument is ignored for undirected graphs.} \value{ \itemize{ \item{\code{ego_size()} returns with an integer vector.} -\item{\code{ego()} returns A list of \code{igraph.vs} or a list of numeric +\item{\code{ego()}/\code{neighborhood()} (synonyms) returns A list of \code{igraph.vs} or a list of numeric vectors depending on the value of \code{igraph_opt("return.vs.es")}, see details for performance characteristics.} \item{\code{make_ego_graph()} returns with a list of graphs.} @@ -68,6 +76,7 @@ see details for performance characteristics.} \description{ These functions find the vertices not farther than a given limit from another fixed vertex, these are called the neighborhood of the vertex. +Note that \code{ego()} and \code{neighborhood()} are synonyms, aliases. } \details{ The neighborhood of a given order \code{r} of a vertex \code{v} includes all @@ -78,7 +87,7 @@ is order 1 plus the immediate neighbors of the vertices in order 1, etc. \code{ego_size()} returns the size of the neighborhoods of the given order, for each given vertex. -\code{ego()} returns the vertices belonging to the neighborhoods of the given +\code{ego()}/\code{neighborhood()} (synonyms) returns the vertices belonging to the neighborhoods of the given order, for each given vertex. \code{make_ego_graph()} is creates (sub)graphs from all neighborhoods of @@ -97,6 +106,10 @@ ego_size(g, order = 2, 1:3) ego(g, order = 0, 1:3) ego(g, order = 1, 1:3) ego(g, order = 2, 1:3) +# neighborhood() is an alias of ego() +neighborhood(g, order = 0, 1:3) +neighborhood(g, order = 1, 1:3) +neighborhood(g, order = 2, 1:3) # attributes are preserved V(g)$name <- c("a", "b", "c", "d", "e", "f", "g", "h", "i", "j")