Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

get_w_connected_cmpts

Get all nodes associated with connected components


Description

Determine which nodes in a graph belong to different weakly connected components (i.e., distinct sets of nodes with traversable paths to and from each node in the set).

Usage

get_w_connected_cmpts(graph)

Arguments

graph

A graph object of class dgr_graph.

Value

A data frame with nodes and their membership in different weakly connected components.

Examples

# Create a graph with 2 cycles
graph <-
  create_graph() %>%
  add_cycle(n = 4) %>%
  add_cycle(n = 3)

# Check if the graph is connected
graph %>%
  is_graph_connected()

# Get the graph's weakly-connected
# components
graph %>% get_w_connected_cmpts()

DiagrammeR

Graph/Network Visualization

v1.0.6.1
MIT + file LICENSE
Authors
Richard Iannone [aut, cre] (<https://orcid.org/0000-0003-3925-190X>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.