Get the number of weakly-connected components
Source:R/count_w_connected_cmpts.R
count_w_connected_cmpts.RdGet the number of weakly-connected components in the graph.
Examples
# 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()
#> [1] 2