Learn R Programming

DiagrammeR (version 1.0.9)

get_non_nbrs: 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)

Value

A vector of node ID values.

Arguments

graph

A graph object of class dgr_graph.

node

A single-length vector containing a node ID value.

Examples

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

# Find all non-neighbors of node `2`
graph %>% get_non_nbrs(node = 2)

Run the code above in your browser using DataLab