get_successors {DiagrammeR} | R Documentation |
Provides a vector of node IDs for all nodes that have a connection from the given node.
get_successors(graph, node)
graph |
a graph object of class
|
node |
a node ID for the selected node. |
a vector of node ID values.
# Create a node data frame (ndf) nodes <- create_nodes( nodes = LETTERS) # Create an edge data frame (edf) edges <- create_edges( from = sample(LETTERS, replace = TRUE), to = sample(LETTERS, replace = TRUE)) # From the ndf and edf, create a graph object graph <- create_graph( nodes_df = nodes, edges_df = edges) # Get sucessors for node `A` in the graph get_successors(graph, node = "A") #> [1] "Z" "Y" # If there are no successors, NA is returned get_successors(graph, node = "Z") #> [1] NA