On Tractability of Learning Bayesian Networks with Ancestral Constraints

Juha Harviainen, Pekka ParviainenAISTATS 2025

Abstract

Expert knowledge can greatly reduce the complexity of Bayesian network structure learning by constraining the search space. These constraints can come in the form of ancestral constraints that relate to the existence of paths between nodes. When the constraints are compiled into a directed acyclic graph, the complexity of learning with ancestral constraints is connected to the number of ideals of the constraint graph. First, we consider precedence constraints which define a partial order that the structure must obey. Taking the path cover number of the constraint graph as a parameter, we extend earlier results to the problems of sampling and weighted counting of network structures. We also consider the problems with related ancestral constraints which state that a node must or cannot be an ancestor of another. With positive ancestral constraints, we show that the problems are tractable under the additional assumption that the constraint graph has only a small number of incomparable edges. On the other hand, the optimization problem is NP-hard with negative ancestral constraints when the path cover number is at least two. Finally, we show that these problems become fixed-parameter tractable if the constraints are compatible with a subclass of partial orders called bucket orders.

Introduction

Learning the structure of a Bayesian Network (BN) from data is a fundamental task in probabilistic graphical modeling, but it is notoriously NP-hard due to the super-exponential growth of the search space of directed acyclic graphs (DAGs). To mitigate this, researchers often incorporate expert knowledge to prune the search space. While prior work has focused on simple edge-level constraints (e.g., "variable A must be a parent of B"), this paper investigates the tractability of learning BNs under more flexible ancestral constraints.

Ancestral Constraints and Their Representation

Ancestral constraints describe the existence (or absence) of directed paths between variables. The authors categorize these into three primary types:

  1. Precedence Constraints: Node $v$ must precede node $u$ in the network's topological ordering.
  2. Positive Ancestral Constraints: Node $v$ must be an ancestor of $u$ (i.e., a directed path exists from $v$ to $u$).
  3. Negative Ancestral Constraints: Node $v$ cannot be an ancestor of $u$.

These constraints are formally represented using an Ancestral Constraint Graph (ACG). Figure 1 illustrates how different types of constraints relate to the underlying graph structure.

Types of Ancestral Constraints

Theoretical Framework: Path Cover Number

The core of the paper's analysis relies on parameterized complexity. The primary parameter used is the path cover number ($pc(D)$), which is the minimum number of directed paths required to cover all nodes in the constraint graph $D$.

For precedence constraints, the authors leverage the fact that the number of "ideals" (subsets of nodes consistent with the partial order) is bounded by the path cover number. By adapting dynamic programming (DP) algorithms, they show that optimization, counting, and sampling problems become polynomial in the number of nodes $n$ when $pc(D)$ is small.

Complexity Results and Tractability

The paper provides a comprehensive map of the tractability landscape for these constraints, identifying where the problem remains efficient and where it becomes computationally "toxic."

Precedence and Positive Ancestral Constraints

Precedence constraints are found to be the most manageable. The authors extend previous optimization results to include weighted counting and sampling, showing they are polynomial in $n$ given a fixed $pc(D)$. Positive ancestral constraints are more complex because they are non-decomposable; tractability here requires an additional parameter: the path cover number of the line graph of the constraints ($pc(D^*)$).

The Hardness of Negative Constraints

A significant finding is the "negative wall." The authors prove that negative ancestral constraints quickly lead to NP-hardness. Specifically, if the constraints specify that "A cannot be an ancestor of B" and the constraint graph has a path cover number $\ge 2$, the optimization problem becomes NP-hard.

Bucket Orders

The authors identify "bucket orders" (where nodes are partitioned into small, ordered sets) as a structure that allows for Fixed-Parameter Tractability (FPT). In this case, the complexity depends on the size of the buckets rather than the total number of variables.

Summary of Results

The following table summarizes the complexity findings for the three main problem variants (Optimization, Counting, and Sampling) across different constraint types.

Complexity Summary Table

Conclusion

This work establishes that while ancestral constraints generally increase the complexity of BN structure learning, tractability can be maintained if the constraints exhibit specific structural properties, such as a small path cover number or compatibility with bucket orders. As this is a theoretical study, no empirical datasets were used; future work may explore "hybrid" constraint sets or algorithms that are sublinear in the number of ideals.

Summary updated

BibTeX
@inproceedings{harviainen2025tractability,
  author = {Juha Harviainen and Pekka Parviainen},
  title = {{On Tractability of Learning Bayesian Networks with Ancestral Constraints}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2025},
  url = {https://openreview.net/forum?id=dTbfmEa8Vt},
}
Figure