4.3 Nodes, Edges and Graphs
POs are combined into Graphs.
The manual way (= hard way) to construct a Graph is to create an empty graph first.
Then one fills the empty graph with POs, and connects edges between the POs.
POs are identified by their $id.
Note that the operations all modify the object in-place and return the object itself.
Therefore, multiple modifications can be chained.
For this example we use the pca PO defined above and a new PO named “mutate”.
The latter creates a new feature from existing variables.
graph = Graph$new()$
add_pipeop(mutate)$
add_pipeop(filter)$
add_edge("mutate", "variance") # add connection mutate -> filterThe much quicker way is to use the %>>% operator to chain POs or Graph s.
The same result as above can be achieved by doing the following:
Now the Graph can be inspected using its $plot() function:
Chaining multiple POs of the same kind
If multiple POs of the same kind should be chained, it is necessary to change the id to avoid name clashes.
This can be done by either accessing the $id slot or during construction: