Linear-Time Algorithms for Front-Door Adjustment in Causal Graphs

Marcel Wienöbst, Benito van der Zander, Maciej Liśkiewicz

This paper presents a major algorithmic breakthrough in causal inference, specifically for the front-door adjustment method. The authors introduce the first linear-time ($O(n+m)$) algorithms for finding and minimizing front-door adjustment sets in directed acyclic graphs (DAGs), improving upon previous state-of-the-art polynomial-time algorithms by a factor of $n^3$ or more.

TL;DR

Researchers have developed asymptotically optimal, linear-time algorithms to identify "front-door" variables that allow us to calculate causal effects even when hidden confounders are present. This leap from $O(n^5)$ to $O(n+m)$ complexity means causal discovery that previously took minutes or hours on medium-sized graphs can now be done in milliseconds, even for networks with hundreds of thousands of variables.

What Problem Does This Paper Address?

In causal inference, we often want to know the effect of a treatment ($X$) on an outcome ($Y$). The "gold standard" is a randomized controlled trial, but when we only have observational data, unobserved confounders ($U$)—variables that influence both $X$ and $Y$—can bias our results.

If we can't measure $U$, we can't use the famous "back-door" adjustment. However, if there are intermediate variables (mediators) that sit between $X$ and $Y$, we can sometimes use the front-door (FD) criterion. While the math for FD adjustment has been known for decades, finding the right set of mediators in a complex graph was computationally expensive. Until recently, the best algorithm ran in $O(n^3(n+m))$ time, which is roughly $O(n^5)$ for dense graphs—far too slow for modern large-scale datasets.

Methods

The authors achieve linear time by reimagining how we traverse the causal graph to check the three conditions of the front-door criterion. Their approach centers on two main algorithms:

  1. FIND (Algorithm 2): This identifies a maximal set of variables $Z$ that satisfies the FD criterion. It uses a modified version of the Bayes-Ball algorithm, a standard tool for checking d-separation in linear time. The key innovation is a new way to identify "forbidden vertices"—nodes that, if included, would violate the FD conditions—in a single graph traversal.
  2. MIN (Algorithm 3): Finding a minimal set (where no subset is also a valid FD set) is often better for statistical estimation because it reduces the number of variables you need to sum over. The authors prove that even though the FD criterion is non-monotonic (see Figure 1), a minimal set can still be found in linear time by carefully pruning the maximal set.
Figure 1: Causal graphs, where X is the treatment, Y the outcome, and U represents an unobserved confounder. Graph (i) is a canonical example, with the (unique) set {Z} satis- fying the front-door (FD) criterion relative to (X, Y ). For graph (ii), there exist 13 FD sets; Both the algorithm of Jeong, Tian, and Bareinboim as well as our basic Algorithm 2, out- put Z = {A, B, C, D} of maximum size. In contrast, Algo- rithm 3 computes minimal FD set {D} of size 1. Graph (iii) illustrates the non-monotonicity of the FD criterion: while both {A, B, C} and {A} are FD sets, neither {A, B} nor {A, C} nor {B, C} satisfy the FD criterion.

They also introduce a generalized graph search framework (Algorithm 6) that can be configured with different "rule tables" to handle various causal search tasks efficiently.

Datasets

The authors evaluated their algorithms using:

  • Erdős-Rényi Graphs: Synthetic random graphs ranging from $2^4$ to $2^{17}$ (over 131,000) vertices to test scalability.
  • bnlearn Repository: A collection of real-world causal graph structures (e.g., alarm, hepar2, munin) used as a benchmark for practical performance.

Key Insights and Ideas

  • Asymptotic Optimality: Since any algorithm must at least read the input graph ($O(n+m)$), these algorithms are as fast as theoretically possible.
  • The Non-Monotonicity Trap: In many causal criteria, if a set $Z$ works, adding more nodes also works. The FD criterion is different; adding a node can actually "break" a valid set. The authors' minimal set algorithm successfully navigates this complexity without sacrificing speed.
  • Minimal vs. Maximum: Previous algorithms returned the largest possible set. The authors show that minimal sets are often much smaller (sometimes size 0 or 1), which significantly simplifies the subsequent statistical estimation of causal effects.

Key Results

  • Massive Speedup: In head-to-head tests against the previous state-of-the-art (JTB), the new FIND algorithm was over 10,000 times faster on medium-sized graphs.
  • Extreme Scalability: While the JTB algorithm failed to terminate within 30 seconds for graphs larger than 256 nodes, the new algorithms handled graphs with 131,072 nodes in a fraction of a second.
Figure 4: Log-Log plot of the average run time in seconds for (Jeong, Tian, and Bareinboim 2022) (JTB), Algorithm 2 (FIND) and Algorithm 3 (MIN) on Erd˝os-R´enyi graphs with 1.5n (left) and 5n (right) edges, corresponding to expected vertex degree 3 and 10. |X|, |Y| are random integers between 1 and 3; |I| = 0 and |R| = 0.5n. For each choice of n, we average over 50 graphs.
  • Practical Implementations: The authors provided open-source implementations in Python, Julia, and JavaScript, ensuring the research can be immediately used by practitioners.

Limitations and Future Work

  • Minimal vs. Minimum: The paper finds a minimal set (no subset works), but not necessarily the minimum set (the smallest possible cardinality). Finding the absolute smallest set remains an open challenge.
  • Known DAGs: The algorithms assume the causal structure (the DAG) is already known. Integrating these fast searches into "causal discovery" (where the graph itself is learned from data) is a promising next step.
  • Relaxing Assumptions: The classical FD criterion is somewhat restrictive (e.g., requiring no back-door paths from $X$ to $Z$). The authors suggest extending their linear-time framework to more generalized versions of the front-door criterion.

Summary updated

Abstract

Causal effect estimation from observational data is a fundamental task in empirical sciences. It becomes particularly challenging when unobserved confounders are involved in a system. This paper focuses on front-door adjustment -- a classic technique which, using observed mediators allows to identify causal effects even in the presence of unobserved confounding. While the statistical properties of the front-door estimation are quite well understood, its algorithmic aspects remained unexplored for a long time. In 2022, Jeong, Tian, and Bareinboim presented the first polynomial-time algorithm for finding sets satisfying the front-door criterion in a given directed acyclic graph (DAG), with an $O(n^3(n+m))$ run time, where $n$ denotes the number of variables and $m$ the number of edges of the causal graph. In our work, we give the first linear-time, i.e., $O(n+m)$, algorithm for this task, which thus reaches the asymptotically optimal time complexity. This result implies an $O(n(n+m))$ delay enumeration algorithm of all front-door adjustment sets, again improving previous work by a factor of $n^3$. Moreover, we provide the first linear-time algorithm for finding a minimal front-door adjustment set. We offer implementations of our algorithms in multiple programming languages to facilitate practical usage and empirically validate their feasibility, even for large graphs.
BibTeX
@inproceedings{wienobst2024linear,
  author = {Marcel Wienöbst and Benito van der Zander and Maciej Liśkiewicz},
  title = {{Linear-Time Algorithms for Front-Door Adjustment in Causal Graphs}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2024},
  doi = {10.1609/aaai.v38i18.30043},
}
Figure