Builds graph data (nodes and edges) describing the pipeline's step
structure, suitable for visualisation with visNetwork::visNetwork().
Examples
p <- pip_new()
pip_add(p, "load", \(x = 1) x, group = "io")
pip_add(p, "clean", \(x = ~load) x + 1, group = "io")
pip_add(p, "fit", \(x = ~clean) x * 2, group = "model")
graph <- pip_get_graph(p)
graph$nodes # data.frame: id, label, group, shape, color
#> id label group shape color
#> 1 0 load io hexagon #47b8ffff
#> 2 1 clean io hexagon #47b8ffff
#> 3 2 fit model hexagon #47b8ffff
graph$edges # data.frame: from, to, arrows
#> from to arrows
#> 1 0 1 to
#> 2 1 2 to
# For a view, include_upstream = TRUE adds upstream deps to the graph
v <- pip_view(p, i = "fit")
pip_get_graph(v, include_upstream = TRUE)
#> $nodes
#> id label group shape color
#> 1 0 load io hexagon #47b8ffff
#> 2 1 clean io hexagon #47b8ffff
#> 3 2 fit model hexagon #47b8ffff
#>
#> $edges
#> from to arrows
#> 1 0 1 to
#> 2 1 2 to
#>
if (require("visNetwork", quietly = TRUE)) {
do.call(what = visNetwork::visNetwork, args = graph)
}
