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

get_s_connected_cmpts

Get nodes within strongly connected components


Description

Determine which nodes in a graph belong to different strongly connected components.

Usage

get_s_connected_cmpts(graph)

Arguments

graph

A graph object of class dgr_graph.

Value

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

Examples

suppressWarnings(RNGversion("3.5.0"))
set.seed(23)

# Create a graph with a random
# connection between 2 different
# node cycles
graph <-
  create_graph() %>%
  add_cycle(
    n = 3,
    type = "cycle_1") %>%
  add_cycle(
    n = 4,
    type = "cycle_2") %>%
  add_edge(
    from =
      get_node_ids(
        graph = .,
        conditions =
          type == "cycle_1") %>%
        sample(size = 1),
    to =
      get_node_ids(
        graph = .,
        conditions =
          type == "cycle_2") %>%
        sample(size = 1))

# Get the strongly connected
# components as a data frame of
# nodes and their groupings
graph %>% get_s_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.