Get all common neighbors between two or more nodes

Description

With two or more nodes, get the set of common neighboring nodes.

Usage

1
get_common_nbrs(graph, nodes)

Arguments

graph

a graph object of class dgr_graph.

nodes

a vector of node ID values of length at least 2.

Value

a vector of node ID values.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Create a directed graph with 5 nodes
graph <-
  create_graph() %>%
  add_path(5)

# Find all common neighbor nodes for nodes
# `1` and `2` (there are no common neighbors)
graph %>% get_common_nbrs(c(1, 2))
#> [1] NA

# Find all common neighbor nodes for nodes
# `1` and `3`
graph %>% get_common_nbrs(c(1, 3))
#> [1] 2

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.