Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

is_node_present

Determine whether a specified node is present


Description

From a graph object of class dgr_graph, determine whether a specified node is present.

Usage

is_node_present(graph, node)

Arguments

graph

A graph object of class dgr_graph.

node

Either a node ID value or a node label to test for presence in the graph.

Value

A logical value.

Examples

# Create a simple graph with
# a path of four nodes
graph <-
  create_graph() %>%
  add_path(
    n = 4,
    type = "path",
    label = c(
      "one", "two",
      "three", "four"))

# Determine if there is a node
# with ID `1` in the graph
graph %>%
  is_node_present(node = 1)

# Determine if there is a node
# with ID `5` in the graph
graph %>%
  is_node_present(node = 5)

# Determine if there is a node
# with label `two` in the graph
graph %>%
  is_node_present(node = "two")

DiagrammeR

Graph/Network Visualization

v1.0.6.1
MIT + file LICENSE
Authors
Richard Iannone [aut, cre] (<https://orcid.org/0000-0003-3925-190X>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.