| caugi_verbs | R Documentation |
caugiAdd, remove, or and set nodes or edges to / from a caugi
object. Edges can be specified using expressions with the infix operators.
Alternatively, the edges to be added are specified using the
from, edge, and to arguments.
add_edges(cg, ..., from = NULL, edge = NULL, to = NULL, inplace = FALSE)
remove_edges(cg, ..., from = NULL, edge = NULL, to = NULL, inplace = FALSE)
set_edges(cg, ..., from = NULL, edge = NULL, to = NULL, inplace = FALSE)
add_nodes(cg, ..., name = NULL, inplace = FALSE)
remove_nodes(cg, ..., name = NULL, inplace = FALSE)
cg |
A |
... |
Expressions specifying edges to add using the infix operators,
or nodes to add using unquoted names, vectors via |
from |
Character vector of source node names. Default is |
edge |
Character vector of edge types. Default is |
to |
Character vector of target node names. Default is |
inplace |
DEPRECATED This parameter is deprecated and will be ignored. Graphs are always modified via copy-on-write. |
name |
Character vector of node names. Default is |
Caugi graph verbs
The updated caugi.
add_edges(): Add edges.
remove_edges(): Remove edges.
set_edges(): Set edge type for given pair(s).
add_nodes(): Add nodes.
remove_nodes(): Remove nodes.
Other verbs:
build()
# 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
# Graphs are now built lazily when needed
parents(cg, "B") # triggers compilation
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.