DiagrammeR (version 1.0.11)

count_w_connected_cmpts: Get the number of weakly-connected components

Description

Get the number of weakly-connected components in the graph.

Usage

count_w_connected_cmpts(graph)

Value

A single integer value representing the number of weakly-connected graph components.

Arguments

graph

A graph object of class dgr_graph.

Examples

Run this code
# Create a cycle graph
graph <-
  create_graph() %>%
  add_cycle(n = 5) %>%
  add_cycle(n = 5)

# Get a count of weakly-connected
# components in the graph
graph %>% count_w_connected_cmpts()

Run the code above in your browser using DataLab