ciflyr
Reachability-Based Primitives for Graphical Causal Inference
Provides a framework for specifying and running flexible linear-time reachability-based algorithms for graphical causal inference. Rule tables are used to encode and customize the reachability algorithm to typical causal and probabilistic reasoning tasks such as finding d-connected nodes or more advanced applications. For more information, see Wienöbst, Weichwald and Henckel (2025) <doi:10.48550/arXiv.2506.15758>.
README
<!-- README.md is generated from README.Rmd. Please edit that file -->
# ciflyr
<!-- badges: start -->
[](https://github.com/mwien/CIfly/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->
ciflyr is the R interface to the CIfly framework for designing efficient
causal inference algorithms based on reductions to graph reachability
specified by rule tables. For more information on CIfly, see our
[website](https://cifly.dev/) and our
[paper](https://arxiv.org/abs/2506.15758).
## Installation
``` r
install.packages("ciflyr")
```
Note that if the package is build from source on your system, as is the
case for Linux distributions, the [Rust toolchain](https://rustup.rs/)
needs to be installed.
## Usage
As a basic example, we show how to test d-separation with CIfly. The
CIfly algorithm specified by the rule table in the variable `dsepTable`
returns all nodes d-connected to the set of nodes `X` given set `Z`.
Based on this information, testing d-separation reduces to checking
membership in a vector.
``` r
library(ciflyr)
dsepTable <- "
EDGES --> <--
SETS X, Z
START <-- AT X
OUTPUT ...
--> | <-- | current in Z
... | ... | current not in Z
"
test_dsep <- function(G, x, y, Z) {
R <- reach(G, list("X" = x, "Z" = Z), dsepTable, tableAsString=TRUE)
return (!(y %in% R))
}
# for graph 1 -> 2 -> 3, test whether 1 is d-separated from 3 by 2
print(test_dsep(list("-->" = rbind(c(1, 2), c(2, 3))), 1, 3, c(2)))
#> [1] TRUE
```
Versions across snapshots
| Version | Repository | File | Size |
|---|---|---|---|
0.1.2 |
rolling linux/jammy R-4.5 | ciflyr_0.1.2.tar.gz |
523.4 KiB |
0.1.2 |
rolling linux/noble R-4.5 | ciflyr_0.1.2.tar.gz |
523.4 KiB |
0.1.2 |
rolling source/ R- | ciflyr_0.1.2.tar.gz |
523.4 KiB |
0.1.2 |
latest linux/jammy R-4.5 | ciflyr_0.1.2.tar.gz |
523.4 KiB |
0.1.2 |
latest linux/noble R-4.5 | ciflyr_0.1.2.tar.gz |
523.4 KiB |
0.1.2 |
latest source/ R- | ciflyr_0.1.2.tar.gz |
523.4 KiB |
0.1.2 |
2026-04-26 source/ R- | ciflyr_0.1.2.tar.gz |
523.4 KiB |
0.1.2 |
2026-04-23 source/ R- | ciflyr_0.1.2.tar.gz |
523.4 KiB |
0.1.2 |
2026-04-09 windows/windows R-4.5 | ciflyr_0.1.2.zip |
278.2 KiB |
Dependencies (latest)
Suggests
- testthat (>= 3.0.0)