Learn R Programming

DiagrammeR (version 1.0.10)

count_unconnected_nodes: Get count of all unconnected nodes

Description

From a graph object of class dgr_graph, get a count of nodes in the graph that are not connected to any other node.

Usage

count_unconnected_nodes(graph)

Value

A numeric vector of single length.

Arguments

graph

A graph object of class dgr_graph.

Examples

Run this code
# Create a graph with a
# path of nodes and 3
# unconnected nodes
graph <-
  create_graph() %>%
  add_path(n = 3) %>%
  add_n_nodes(n = 3)

# Get a count of all nodes
# in the graph
graph %>% count_nodes()

# Get a count of all
# unconnected nodes in the
# graph
graph %>%
  count_unconnected_nodes()

Run the code above in your browser using DataLab