cg <- caugi(
A %-->% B + C,
B %-->% D,
C %-->% D,
class = "DAG"
)
# Default: auto-selects best layout
layout <- caugi_layout(cg)
# Auto-selects tiered when tiers provided
cg_tiered <- caugi(X1 %-->% M1, X2 %-->% M2, M1 %-->% Y, M2 %-->% Y)
tiers <- list(c("X1", "X2"), c("M1", "M2"), "Y")
layout_auto <- caugi_layout(cg_tiered, tiers = tiers) # Uses "tiered"
# Explicitly use hierarchical layout
layout_sug <- caugi_layout(cg, method = "sugiyama")
# Use force-directed for organic appearance
layout_fr <- caugi_layout(cg, method = "fruchterman-reingold")
# Use stress minimization for publication quality
layout_kk <- caugi_layout(cg, method = "kamada-kawai")
# Bipartite layout with auto-detected partition
cg_bp <- caugi(A %-->% X, A %-->% Y, B %-->% X, B %-->% Y)
layout_bp_rows <- caugi_layout(
cg_bp,
method = "bipartite",
orientation = "rows"
)
# Explicit partition
partition <- c(TRUE, TRUE, FALSE, FALSE)
layout_bp_cols <- caugi_layout(
cg_bp,
method = "bipartite",
partition = partition,
orientation = "columns"
)
# Tiered layout with three tiers
cg_tiered <- caugi(
X1 %-->% M1 + M2,
X2 %-->% M1 + M2,
M1 %-->% Y,
M2 %-->% Y
)
tiers <- list(c("X1", "X2"), c("M1", "M2"), "Y")
layout_tiered <- caugi_layout(
cg_tiered,
method = "tiered",
tiers = tiers,
orientation = "rows"
)
Run the code above in your browser using DataLab