| caugi | R Documentation |
caugi from edge expressions.Create a caugi from a series of edge expressions using
infix operators. Nodes can be specified as symbols, strings, or numbers.
The following edge operators are supported by default:
%-->% for directed edges (A –> B)
%---% for undirected edges (A — B)
%<->% for bidirected edges (A <-> B)
%o->% for partially directed edges (A o-> B)
%--o% for partially undirected edges (A –o B)
%o-o% for partial edges (A o-o B)
You can register additional edge types using register_caugi_edge().
caugi(
...,
from = NULL,
edge = NULL,
to = NULL,
nodes = NULL,
edges_df = NULL,
simple = TRUE,
build = NULL,
class = c("AUTO", "DAG", "UG", "PDAG", "MPDAG", "CPDAG", "ADMG", "AG", "UNKNOWN"),
state = NULL,
.session = NULL
)
... |
Edge expressions using the supported infix operators, or
nodes given by symbols or strings. Multiple edges can be
combined using |
from |
Character vector of source node names.
Optional; mutually exclusive with |
edge |
Character vector of edge types.
Optional; mutually exclusive with |
to |
Character vector of target node names.
Optional; mutually exclusive with |
nodes |
Character vector of node names to declare as isolated nodes.
An optional, but recommended, option is to provide all node names in the
graph, including those that appear in edges. If |
edges_df |
Optional data.frame or data.table with columns
|
simple |
Logical; if |
build |
DEPRECATED. The graph is always built lazily, so this argument is ignored.
Can use |
class |
Character; one of |
state |
DEPRECATED. Replaced by |
.session |
For internal use. Build a graph by supplying a pre-constructed session pointer from Rust. |
A caugi S7 object containing the nodes, edges, and a
pointer to the underlying Rust graph structure.
# create a simple DAG (using NSE)
cg <- caugi(
A %-->% B + C,
B %-->% D,
class = "DAG"
)
# create a PDAG with undirected edges (using NSE)
cg2 <- caugi(
A %-->% B + C,
B %---% D,
E, # no neighbors for this node
class = "PDAG"
)
# create a DAG (using SE)
cg3 <- caugi(
from = c("A", "A", "B"),
edge = c("-->", "-->", "-->"),
to = c("B", "C", "D"),
nodes = c("A", "B", "C", "D", "E"),
class = "DAG"
)
# create a non-simple graph
cg4 <- caugi(
A %-->% B,
B %-->% A,
class = "UNKNOWN",
simple = FALSE
)
cg4@simple # FALSE
cg4@graph_class # "UNKNOWN"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.