add_cycle {DiagrammeR} | R Documentation |
With a graph object of class
dgr_graph
, add a node cycle to the graph.
add_cycle(graph, n, type = NULL, label = TRUE, rel = NULL)
graph |
a graph object of class
|
n |
the number of nodes comprising the cycle. |
type |
an optional string that describes the entity type for the nodes to be added. |
label |
either a vector object of length
|
rel |
an optional string for providing a relationship label to all new edges created in the node cycle. |
a graph object of class dgr_graph
.
# Create a new graph and add a cycle of nodes to it graph <- create_graph() %>% add_cycle(6) # Get node information from this graph node_info(graph) #> id type label deg indeg outdeg loops #> 1 1 <NA> 1 2 1 1 0 #> 2 2 <NA> 2 2 1 1 0 #> 3 3 <NA> 3 2 1 1 0 #> 4 4 <NA> 4 2 1 1 0 #> 5 5 <NA> 5 2 1 1 0 #> 6 6 <NA> 6 2 1 1 0