ciflyr: Reachability-Based Primitives for Graphical Causal Inference

Marcel Wienöbst, Sebastian Weichwald, Leonard HenckelOpenalex Unknown 2025 · DOI · OpenAlex

Abstract

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).

Introduction

In graphical causal inference, many fundamental tasks—such as determining d-separation or conditional independence—are essentially reachability problems. These tasks require checking for active paths between variables given a set of observations. While standard algorithms exist, they are often hard-coded for specific criteria. As researchers explore new graph types (e.g., those involving selection bias or latent variables), the need for a generalized, programmable framework becomes critical.

ciflyr addresses this by providing a high-performance R package that implements a flexible, linear-time framework for graphical causal inference. By utilizing customizable "rule tables," researchers can implement complex reachability algorithms with the efficiency of a Rust-based backend.

The ciflyr Framework: Rule Tables and Rust

The core innovation of ciflyr is the separation of graph structure from traversal logic. Instead of hard-coding rules, the package allows users to define how "signals" propagate through different edge types and node states via rule tables. This abstraction allows causal inference researchers to experiment with new graphical models without worrying about the underlying algorithmic implementation.

Technical Architecture

  • Rust Backend: Built using Rust via the rextendr package, ciflyr ensures memory safety and execution speeds comparable to C++.
  • Linear-Time Complexity: The underlying reachability primitive is mathematically guaranteed to run in linear time relative to the graph size, making it suitable for large-scale datasets in genomics or social network analysis.
  • Edge-Type Mapping: Users can define custom edge types (e.g., directed, bi-directed, or undirected) and specify their interactions within the rule table.

Implementation and API

To optimize performance for repeated queries, ciflyr provides functions to convert R objects into optimized internal representations before running the main algorithm.

The parseSets function converts R objects into an internal representation for optimized processing.

The primary entry point for users is the reach() function. This function takes a graph, a set of nodes, and a rule table to return all reachable nodes.

The reach() function accepts several arguments, including the graph, node sets, and the rule table defining the algorithm.

By providing explicit parsing functions like parseGraph and parseSets, the package is designed for "big data" causal discovery, where a single graph might be queried thousands of times with varying conditioning sets.

Conclusion

ciflyr provides a functional, linear-time reachability tool for the R ecosystem, abstracting the complexity of graph theory into accessible, string-based rule tables. While it requires a Rust environment for compilation, it offers a powerful primitive for researchers developing new graphical criteria. Future work, detailed in Wienöbst et al. (2025), provides the formal theoretical justification for these reachability primitives.

Summary updated

Abstract

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) &lt;<a href="https://doi.org/10.48550%2FarXiv.2506.15758" target="_top">doi:10.48550/arXiv.2506.15758</a>&gt;.
BibTeX
@inproceedings{wienobst2025ciflyr,
  author = {Marcel Wienöbst and Sebastian Weichwald and Leonard Henckel},
  title = {{ciflyr: Reachability-Based Primitives for Graphical Causal Inference}},
  booktitle = {Openalex Unknown},
  year = {2025},
  doi = {10.32614/cran.package.ciflyr},
}
Figure