Takes an arbitrary amount of Graphs or PipeOps (or objects that can be automatically converted into Graphs or PipeOps, see as_graph() and as_pipeop()) as inputs and joins them in a new Graph.

The PipeOps of the input Graphs are not joined with new edges across Graphs, so if length(graphs) > 1, the resulting Graph will be disconnected.

This operation always creates deep copies of its input arguments, so they cannot be modified by reference afterwards. To access individual PipeOps after composition, use the resulting Graph's $pipeops list.

gunion(graphs, in_place = FALSE)

Arguments

graphs

list of (Graph | PipeOp | NULL | ...)
List of elements which are the Graphs to be joined. Elements must be convertible to Graph or PipeOp using as_graph() and as_pipeop(). NULL values automatically get converted to PipeOpNOP with a random ID of the format nop_********. The list can be named, in which case the IDs of the elements are prefixed with the names, separated by a dot (.).

in_place

(logical(1) | logical)
Whether to try to avoid cloning the first element of graphs, similar to the difference of %>>!% over %>>%. This can only be avoided if graphs[[1]] is already a Graph.
Unlike chain_graphs(), gunion() does all checks before mutating graphs[[1]], so it will not leave graphs[[1]] in an incompletely modified state when it fails.
in_place may also be of length graph, in which case it determines for each element of graphs whether it is cloned. This is for internal usage and is not recommended.

Value

Graph the resulting Graph.

See also

Other Graph operators: %>>%(), as_graph(), as_pipeop(), assert_graph(), assert_pipeop(), chain_graphs(), greplicate(), pipeline_greplicate()