Causal Graph Interface
Overview
Create, query, and modify causal graphs. 'caugi' (Causal Graph Interface) is a causality-first, high performance graph package that provides a simple interface to build, structure, and examine causal relationships.
New Features
- Add
enumerate_dags()to enumerate every DAG in the Markov equivalence class of a PDAG, andcount_dags()to return the MEC size without materializing every DAG (#297). plot()now automatically bends edges around non-incident nodes that they would otherwise pass straight through, so edges between collinear nodes (e.g. within a tier) and edges crossing unrelated nodes stay visible. This is controlled byedge_style$route(defaultTRUE); disable it withedge_style = list(route = FALSE), or per edge type/edge via the usualedge_styleoverrides.- Add
==and!=methods forcaugiobjects socg1 == cg2returns a single logical comparing graph content (class, nodes, edges,simple) rather than session identity.
Show all changes in 1.3.0Hide the rest of the changes in 1.3.0
- Add first-class
"CPDAG"graph class support across the constructor (caugi()), coercion (as_caugi()), and class mutation (mutate_caugi()). Construction validates the full CPDAG invariant (chordal chain components, an acyclic component DAG, Meek closure, and strong arrow protection).generate_graph(class = "CPDAG")now returns a graph with@graph_class = "CPDAG"instead of"MPDAG", the precise label for the essential graph of a Markov equivalence class. Predicates defined on PDAGs and MPDAGs (is_pdag(),is_mpdag(), etc.) continue to accept CPDAGs unchanged. - Meek-closed PDAGs are now reported with
@graph_class = "MPDAG"instead of"PDAG". This affects the result ofmeek_closure()andgenerate_graph(class = "CPDAG"). Predicates and verbs defined on PDAGs (is_pdag(),mutate_caugi(), etc.) continue to accept MPDAGs unchanged.
Improvements
aid()is now implemented natively in caugi's Rust backend, removing the externalgadjiddependency (and its pinned git revision and vendored sources). Results are unchanged. The AID implementation (src/rust/src/graph/aid.rs) is a derivative ofgadjidand is licensed MPL-2.0; the rest of the crate remains MIT.aid()now takes inputs of class"DAG"or"CPDAG"(previously"DAG"or"PDAG").- Licensing of bundled code is now declared for CRAN: a top-level
LICENSE.notedocuments the MPL-2.0 component (the AID files derived fromgadjid) and the licenses of the vendored Rust crates, and their copyright holders are recorded viacph/ctbroles inAuthors@R. adjustment_set(type = "backdoor")now returns an inclusion-minimal backdoor adjustment set, computed in linear time as a minimal d-separator in the proper backdoor graph, rather than the full set of parents of the exposure.- The performance vignette is now a true vignette (rather than a pkgdown-only article) and is rebuilt manually from a cross-language harness under
tools/benchmark/. The harness comparescaugitoigraph,bnlearn,dagitty,ggm,pcalg,pgmpy, and Tetrad on an ∈ {100, 1000, 10000}grid. The d-separation benchmark now uses a minimal d-separator computed viaminimal_separator()(previously used a backdoor adjustment set, which is not in general a d-separating set).
Bug Fixes
- Fix
hd()returning results that depended on the order in which nodes were declared. The Hamming distance now aligns nodes by name before comparing, so logically identical graphs always give the same distance (#323). - Fix
dag_from_pdag()failing with `from,edge,tomust be equal length.` when a sink had multiple undirected neighbors (#298). - Fixed a bug causing a partially undirected (
--o) edges to be plotted as undirected edges. - Fix
adjustment_set(type = "backdoor")returning an invalid (often empty) set when a parent of the exposure lies on a backdoor path but is not an ancestor of the outcome (#308). The result is now always a valid backdoor adjustment set. - Fixed
is_mag()returning incorrect results for some ancestral graphs (#309). Adjacency was tested by binary-searching the concatenation of separately sorted neighbor buckets, which is not globally sorted, so some adjacent pairs were missed. - Stripped non-build files (
tests/,examples/, trybuild fixtures) from the vendored Rust dependencies so no vendored path exceeds 100 characters. This silences pak's "very long paths" warning and avoids installation failures on Windows without long-path support (#319). - Fixed
to_dot()andto_mermaid()(andwrite_dot()/write_mermaid()) silently converting partial--oando-oedges into plain directed edges, dropping the circle endpoints (#307).
Deprecations
- The first argument of
dag_from_pdag()is now namedcg, matching the convention used by the rest of the package. The previous namePDAGcontinues to work as an alias but emits a deprecation warning.
From NEWS.md in the release
Install
Health
- OK13 OK2026-09-12
- NOTE12 OK, 1 NOTE2026-07-11
- OK13 OK2026-05-02
- NOTE11 OK, 1 NOTE2026-04-25
- OK14 OK2026-04-16
Show 2 earlier changesHide 2 earlier changes
- NOTE13 OK, 1 NOTE2026-03-28
- OK14 OK2026-03-10
Documentation
- Help pages
- 139 (40 internal)includes a package overview page
- Examples that run
- 100%89 run in a plain check
- Exported functions with examples
- 93%
- Documented parameters
- 93%
- Return-value docs
- 100%
- Help pages citing references
- 7%
Downloads
Repository
- PRs merged (all time)
- 90%
- Median days to close, 50 most recently updated closed issues
- 7
- Median days to close, 50 most recently updated closed PRs
- 6
Stars over time
Forks over time
Releases over time
Issues over time
PRs over time
Commits over time
Commit identities over time
14 development-tooling and community-health practices detected across 7 families in the upstream repository
Checks run against github.com/frederikfabriciusbjerre/caugi on 2026-10-21.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
GitHub Pages site last deployed 2026-10-16 · The repository has a site deploy workflow
pkgdown site last built 2026-10-16
Show all practicesHide 3 practices
This repository shows signs of AI coding tools.
- GitHub Copilotfirst seen 2025-10-20Seen in the repository: .github/instructionsPull request: opened by its own accountCommits: 37 by its own account
- Cursorfirst seen 2026-01-15Named in .gitignore: .cursor
- Claude Codefirst seen 2026-04-29Seen in the repository: CLAUDE.mdNamed in .Rbuildignore: .claude, CLAUDE.mdNamed in .gitignore: .claudePull request it wrote: opened by a project memberCommits: at least 8 crediting it in the message
- Claude Opus 4.86 commits · Jun to Sep 2026
- Claude Opus 52 commits · Sep 2026
Dependencies
Installing caugi adds 2 packages (2 with compiled code, 5.9 MB of source tarballs). Heaviest: data.table 5.7 MB, S7 180 KB.
Code & Tests
People & History
Pick two releases to compare their code metrics.
- 1.3.0Latest2026-09-09 · current release · diff ↗ ·
removed 2 exports
plot, printadded 2 exports
count_dags, enumerate_dags - 1.2.0
- RR 4.6.0 released · 2026-04-24
- 1.1.02026-03-20 · diff ↗ ·
added 8 exports
compare_proxy.caugi::caugi, dag_from_pdag, is_mpdag, is_simple, meek_closure, minimal_d_separator, normalize_latent_structure, posteriors - 1.0.02026-01-22 · diff ↗ ·
added 39 exports
all_adjustment_sets_admg, anteriors, caugi_default_options, caugi_deserialize, caugi_dot, caugi_export, caugi_graphml, caugi_layout, caugi_layout_bipartite, caugi_layout_fruchterman_reingold, caugi_layout_kamada_kawai, caugi_layout_sugiyama, caugi_layout_tiered, caugi_mermaid, caugi_options, caugi_plot, caugi_serialize, condition_marginalize, districts, exogenize, is_admg, is_ag, is_mag, is_valid_adjustment_admg, latent_project, m_separated, plot, read_caugi, read_graphml, simulate_data and 9 more - 0.3.12025-12-04
- RR 4.5.0 released · 2025-04-11
Package metadata
- First published
- 2025-12-04
- Total releases
- 5 / 1 yrs
- License
- MIT + file LICENSE OSI
- Minimum R
- ≥ 4.2
- Download size
- 3.5 MB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("caugi")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-25, which the citation names so these numbers can be found later. More on citing and the projects behind them.