Skip to contents

Get the pipeline as a graph with nodes and edges.

Usage

pipe_get_graph(pip, groups = NULL)

Arguments

pip

Pipeline object

groups

character if not NULL, only steps belonging to the given groups are considered.

Value

list with two data frames, one for nodes and one for edges ready to be used with the visNetwork::visNetwork() function of the visNetwork package.

Examples

p <- pipe_new("pipe", data = 1:2)
pipe_add(p, "add1", \(data = ~data, x = 1) x + data)
pipe_add(p, "add2", \(x = 1, y = ~add1) x + y)
pipe_add(p, "mult1", \(x = ~add1, y = ~add2) x * y)
graph <- pipe_get_graph(p)
graph
#> $nodes
#>   id label group    shape     color   title
#> 1  1  data  data database lightblue <p></p>
#> 2  2  add1  add1      box lightblue <p></p>
#> 3  3  add2  add2      box lightblue <p></p>
#> 4  4 mult1 mult1      box lightblue <p></p>
#> 
#> $edges
#>         from to arrows
#> add1       1  2     to
#> add2       2  3     to
#> mult1.x    2  4     to
#> mult1.y    3  4     to
#> 

if (require("visNetwork", quietly = TRUE)) {
    do.call(visNetwork, args = graph)
}