Learn R Programming

caugi (version 1.0.0)

build: Build the graph now

Description

If a caugi has been modified (nodes or edges added or removed), it is marked as not built, i.e cg@built = FALSE. This function builds the graph using the Rust backend and updates the internal pointer to the graph. If the graph is already built, it is returned.

Usage

build(cg, ...)

Value

The built caugi object.

Arguments

cg

A caugi object.

...

Not used.

See Also

Other verbs: caugi_verbs

Examples

Run this code
# initialize empty graph and build slowly
cg <- caugi(class = "PDAG")

cg <- cg |>
  add_nodes(c("A", "B", "C", "D", "E")) |> # A, B, C, D, E
  add_edges(A %-->% B %-->% C) |> # A --> B --> C, D, E
  set_edges(B %---% C) # A --> B --- C, D, E

cg <- remove_edges(cg, B %---% C) |> # A --> B, C, D, E
  remove_nodes(c("C", "D", "E")) # A --> B

# verbs do not build the Rust backend
cg@built # FALSE
build(cg)
cg@built # TRUE

Run the code above in your browser using DataLab