caugi 1.1.0
New Features
- Add
normalize_latent_structure(), which normalizes the latent structure of a DAG while preserving the marginal model over observed variables. - Add
minimal_d_separator(), which computes a minimal d-separator between sets of nodes in a DAG, with support for mandatory inclusions and restrictions. - Add
posteriors()query function, which is the dual ofanteriors(). It returns all nodes reachable by following paths where every edge is either undirected or directed away from the source node. For DAGs,posteriors()equalsdescendants(). For PDAGs and AGs, it includes both descendants and nodes reachable via undirected edges. - You can now specify whether to use an open or closed graph definition for the queries
ancestors(),anteriors(),descendants(), andposteriors(). This can be set globally withcaugi_options()or locally with theopen = TRUE/FALSEargument. The default remainsopen = TRUE. - Add
is_mpdag()query to check whether a PDAG is closed under Meek’s orientation rules (R1-R4), andmeek_closure()to orient all implied edges until Meek closure.
Improvements
-
caugi_options()now supports nested key drilling: multiple unnamed arguments traverse nested options (e.g.,caugi_options("plot", "tier_style", "fill")). - Rust remains the single source of truth for graph state. Graph properties (
simple,graph_class,nodes,edges) are sourced from thesession.- A session is always created, including empty graphs (n = 0), which simplifies property access.
- Deprecated compatibility properties
@.state,@name_index_map,@built, and@ptrnow warn on access and returnNULL. - Deprecated compatibility constructor arguments
buildandstateincaugi()now warn and are ignored.
- The
inplaceparameter in verb functions (add_edges(),remove_edges(),set_edges(),add_nodes(),remove_nodes()). All graph modifications now use copy-on-write semantics for consistency with R conventions. The parameter is deprecated and ignored with a warning. - Added
all.equalandcompare_proxymethods for caugi objects to support graph-content comparison in tests. - Add
aspparameter toplot()for controlling the aspect ratio. Whenasp = 1, the plot respects equal units on both axes, preserving the layout coordinates. Works like base R’saspparameter (y/x aspect ratio) (#195). - Add
pdag_to_dag()function that generates a random DAG consistent with a given CPDAG/PDAG structure if possible (#201).
Bug Fixes
- Fixed a bug causing
plot()to use incorrect layout if node names were not in the same order as in the graph object (#198). - Fixed
set_edges()so that it correctly replaces symmetric edges in simple graphs.
Deprecations
- The parameter
allindistricts()has been deprecated. Usedistricts()without arguments to get all districts.
caugi 1.0.0
CRAN release: 2026-01-22
New Features
- Add support for Ancestral Graphs (AGs), which combine directed (
-->), bidirected (<->), and undirected (---) edges while satisfying ancestral graph constraints. New functions:is_ag(),is_mag(). - Add
modeargument toneighbors()/neighbours()to filter neighbors by edge direction or type ("all","in","out","undirected","bidirected","partial"). This is a structural query, and not a semantic query! -
neighbors()now supportsclass = "UNKNOWN"graphs, includingmode-based filtering. - Add
simulate_data()that enables simulation from DAGs using SEMs. Standard linear Gaussian SEMs are defaults, but more importantly custom SEMs are available. - Add
"AUTO"parameter forclassincaugiobjects. This automatically picks the graph class in orderDAG,UG,PDAG,ADMG,AG. - Add Ancestral Graphs (AG) with support for directed, bidirected, and undirected edges, plus new queries
is_ag()andis_mag()and m-separation for AGs. - Add
exogenize()function that exogenizes variables for any graph type. Current implementation is written in R, but it is so simple that it might be preferable over a Rust implementation. This might be changed later. - Add
latent_project()function that does latent projection from DAGs to ADMGs. - Add native caugi serialization format for saving and loading graphs. New functions:
write_caugi(),read_caugi(),caugi_serialize(), andcaugi_deserialize(). The format is a versioned JSON schema that captures graph structure, class, and optional metadata (comments and tags). - Add
plot()method for visualizing graphs using various layout algorithms. The plot is rendered using grid graphics and returns acaugi_plotobject that can be customized withnode_style,edge_style, andlabel_stylearguments. Theplot()method accepts layouts as strings, functions, or pre-computed data.frames. - Add
caugi_layout()function to compute node coordinates for graph visualization. - Add dedicated layout functions:
caugi_layout_sugiyama(),caugi_layout_fruchterman_reingold(),caugi_layout_kamada_kawai(),caugi_layout_bipartite(), andcaugi_layout_tiered(). Each function provides an API for its specific algorithm. - Add
to_dot()andwrite_dot()functions for exporting caugi graphs to DOT (graphviz) format. The resulting object is a new S7 class,caugi_export, which has aknit_print()method for rendering DOT graphs in R Markdown and Quarto documents. - Add GraphML and Mermaid import/export support:
to_graphml,write_graphml,read_graphml,to_mermaid,write_mermaid, andread_mermaid - Add plot composition operators for creating multi-plot layouts:
+and|for horizontal arrangement,/for vertical stacking. Compositions can be nested arbitrarily (e.g.,(p1 + p2) / p3). - Add
caugi_options()function for setting global defaults for plot appearance, including composition spacing and default styles for nodes, edges, labels, and titles. - Add
caugi_default_options()function to query or reset to package default options. - Add a new vignette, “Graph Visualization with caugi”, demonstrating the new plotting capabilities and customization options.
Improvements
- Add favicons for the package website.
- Standardize
is_caugi()validation calls internally. - Adopt air as the R code formatter for the package.
-
caugi_layout_tiered()now returns atiercolumn andorientationattribute in the layout data.frame, allowingplot()to automatically use tier information without requiring thetiersargument to be passed again.
Bug Fixes
- Fix typo in error messages and documentation examples.
- Remove unused
index_name_mapparameter from internal.cg_state()function. - Fix interpretation of directed edge endpoint positions in the Rust backend, improving correctness of direction-dependent algorithms/metrics (e.g. topological sorting and structural Hamming distance computations).
- Fix bug in
is_cpdagfunction that returnsTRUEon non-complete PDAGs. - Fix bug in
shdreturning positive values for equivalent graphs given in shuffled order.
caugi 0.4.0
- Add support for Acyclic Directed Mixed Graphs (ADMGs), which combine directed edges representing causal relationships with bidirected edges representing latent confounding.
- Add new functions for querying ADMGs:
is_admg(),spouses(),districts(), andm_separated()(generalization of d-separation for graphs with bidirected edges). - Add functions for adjustment set validation in ADMGs:
is_valid_adjustment_admg()andall_adjustment_sets_admg()implementing the Generalized Adjustment Criterion. - Add
mutate_caugi()function that allows conversion from one graph type to another. - Add custom printing method for
caugiobjects. - Add optional
edges_dfargument tocaugi()for easier construction from existing data frames containing the columnsfrom,edge, andto. - Improve error handling across all graph types (DAG, PDAG, UG, ADMG) with more descriptive error messages.
- Update
as_adjacency()andas_igraph()to support bidirected edges. - Update
as_caugi()documentation to include “ADMG” as a valid class type for conversion.
caugi 0.3.2
- Change website to
caugi.org/. - Minor modifications to
CONTRIBUTING.md. - Minor
READMErewrite.
caugi 0.3.1
CRAN release: 2025-12-04
- Remove the use of
lockBindingandunlockBindingin the package to silence R CMD check notes.
caugi 0.3.0
- Add
mutate_caugifunction that allows conversion from one graph type to another. - Add custom printing method.
- Add optional
edges_dfargument tocaugifor easier construction from existing data frames containing the columnsfrom,edge, andto. - Update How to use
caugiin a package vignette to use new conversion functionality. - Add
CONTRIBUTING.mdto github.
caugi 0.2.1
- Update function documentation to make package CRAN ready.
- Update performance vignette and change it to article.
- Add Michael Sachs and Johan Larsson to Authors in DESCRIPTION.
- Patch S4 class reading for
as_caugi.