Learn R Programming

DiagrammeR (version 0.8.2)

is_graph_empty: Is the graph empty?

Description

Provides a logical value on whether the graph is empty (i.e., contains no nodes).

Usage

is_graph_empty(graph)

Arguments

graph
a graph object of class dgr_graph.

Value

a logical value.

Examples

Run this code
## Not run: 
# # Create an empty graph
# graph <- create_graph()
# 
# # Determine whether the graph is empty
# is_graph_empty(graph)
# #> [1] TRUE
# 
# # Create a graph with nodes and edges
# nodes <-
#   create_nodes(nodes = c("a", "b", "c", "d"))
# 
# edges <-
#   create_edges(from = c("a", "b", "c"),
#                to = c("d", "c", "a"))
# 
# graph <-
#   create_graph(nodes_df = nodes,
#                edges_df = edges)
# 
# # Determine whether the graph is empty
# is_graph_empty(graph)
# #> [1] FALSE
# ## End(Not run)

Run the code above in your browser using DataLab