Counting and Sampling Markov Equivalent Directed Acyclic Graphs

Topi Talvitie, Mikko Koivisto

In causal discovery, researchers often encounter a fundamental ambiguity: multiple Directed Acyclic Graphs (DAGs) can represent the same set of conditional independence constraints. These DAGs form a Markov equivalence class. To perform robust causal inference or design informative experiments, it is crucial to count how many such DAGs exist and to be able to sample from them uniformly.

This paper by Topi Talvitie and Mikko Koivisto introduces two novel algorithms, MemoMao and TreeMao, that significantly accelerate these tasks. By shifting the computational complexity from super-exponential to more manageable exponential bounds, these methods enable the analysis of graphs with hundreds of nodes in seconds.

The Challenge of Markov Equivalence

When learning a causal model from observational data, the result is typically an essential graph. In this representation, some edges are directed (representing invariant causal directions), while others are undirected. Any valid orientation of these undirected edges that avoids creating new "immoralities" (patterns like $A \rightarrow B \leftarrow C$ where $A$ and $C$ are non-adjacent) or cycles results in a Markov equivalent DAG.

Visualizing the transformation from a DAG to its essential graph and subsequent subproblems for counting.

The problem reduces to counting and sampling Moral Acyclic Orientations (MAOs) of undirected connected chordal graphs (UCCGs). Previous state-of-the-art methods relied on $O(n!)$ recurrences, which quickly became intractable as the number of variables grew.

Algorithmic Innovations: MemoMao and TreeMao

The authors propose two distinct strategies to tackle the counting and sampling problem:

  1. MemoMao (Dynamic Programming): This algorithm utilizes a "sum-product" recurrence based on picking a unique "source" vertex (a vertex with no incoming edges). Selecting a source fixes certain edge directions and decomposes the remaining graph into independent chordal components. The key innovation is the use of memoization to store results for induced subgraphs, reducing the complexity to $O(2^n n^4)$.
  2. TreeMao (Tree Decomposition): Designed for sparse graphs, this approach leverages the clique tree structure of chordal graphs. It uses fast subset convolution to efficiently combine results across the tree decomposition. Its complexity is $O(k! 2^k k^2 n)$, where $k$ is the maximum clique size.

For sampling, both algorithms utilize the weights calculated during the counting phase. By applying the alias method, they can generate uniform samples in linear time relative to the graph size.

Performance and Empirical Insights

The algorithms were benchmarked on randomly generated UCCGs with up to 1024 vertices and varying edge densities. The results demonstrate a dramatic performance leap:

  • Speed: MemoMao can process dense graphs in a fraction of a second where previous methods would time out.
  • Scalability: The researchers successfully handled graphs with over a thousand vertices on standard hardware.
  • Selection Rule: Empirical data suggests that MemoMao is generally superior unless the graph is exceptionally sparse ($n \leq 2^{r+4}$, where $r$ is a density parameter), in which case TreeMao excels.

Future Directions

While $O(2^n)$ is a major improvement, the problem's exact complexity class remains an open question—specifically, whether it is #P-hard or if a polynomial-time solution exists. Future work may involve exploiting graph symmetries more formally or developing approximation schemes (FPRAS) for extremely large, dense graphs that remain beyond the reach of exact exponential algorithms.

Summary updated

BibTeX
@inproceedings{talvitie2019counting,
  author = {Topi Talvitie and Mikko Koivisto},
  title = {{Counting and Sampling Markov Equivalent Directed Acyclic Graphs}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2019},
  doi = {10.1609/aaai.v33i01.33017984},
}
Figure