get_articulation_points: Get articulation points

Description Usage Arguments Value Examples

View source: R/get_articulation_points.R

Description

Get the nodes in the graph that are identified as articulation points.

Usage

1

Arguments

graph

a graph object of class dgr_graph.

Value

a vector of node IDs.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Create a random graph and make every node
# shape a `square`
graph <-
  create_random_graph(
    n = 30, m = 50,
    set_seed = 23) %>%
  set_node_attrs(
    node_attr = "shape",
    values = "square")

# Get the articulation points in the graph (i.e.,
# those nodes that if any were to be removed, the
# graph would become disconnected)
get_articulation_points(graph)
#> [1]  9 10 12 19 22 26 30

# For the articulation points, change the node
# shape to a `circle`
graph <-
  graph %>%
  select_nodes_by_id(
    nodes = get_articulation_points(.)) %>%
  set_node_attrs_ws(
    node_attr = "shape",
    value = "circle")

DiagrammeR documentation built on Sept. 7, 2017, 1:06 a.m.