get_non_nbrs {DiagrammeR}R Documentation

Get non-neighbors of a node in a graph

Description

Get the set of all nodes not neighboring a single graph node.

Usage

get_non_nbrs(graph, node)

Arguments

graph

a graph object of class dgr_graph.

node

a single-length vector containing a node ID value.

Value

a vector of node ID values.

Examples

# Create a simple, directed graph with 5
# nodes and 4 edges
graph <-
  create_graph() %>%
  add_path(5)

# Find all non-neighbors of node `2`
graph %>% get_non_nbrs(2)
#> [1] 4 5

[Package DiagrammeR version 0.9.0 Index]