is_graph_empty {DiagrammeR} | R Documentation

## 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

    # Create an empty graph
    graph <- create_graph()

    # Determine whether the graph is empty
    is_graph_empty(graph)
    #> [1] TRUE

    # Create a non-empty graph
    graph <-
      create_graph() %>%
      add_n_nodes(n = 3)

    # Determine whether this graph is empty
    is_graph_empty(graph)
    #> [1] FALSE

[Package DiagrammeR version 0.9.2 Index]