NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Solving the Tree Containment Problem Using Graph Neural Networks

Arkadiy Dushatskiy, Esther Julien, Leen Stougie, Leo van Iersel

TL;DR

This paper introduces Combine-GNN, the first machine learning approach to tackle the NP-complete tree containment problem in phylogenetics. By merging a phylogenetic tree and network into a single shared-leaf graph, the authors train a Graph Neural Network (GNN) that achieves over 95% accuracy. Crucially, the method exhibits strong inductive learning, successfully generalizing to evolutionary structures far larger than those seen during training.

What Problem Does This Paper Address?

In evolutionary biology, a species' history isn't always a simple branching tree. Events like hybridization and lateral gene transfer create web-like evolutionary pathways, which scientists model using directed acyclic graphs called phylogenetic networks. However, individual genes or DNA fragments still tend to evolve in a tree-like fashion.

To validate a proposed phylogenetic network, biologists ask a fundamental question: Does this network contain the evolutionary tree observed in our genetic data? This is the tree containment problem.

Figure 1: Examples of the tree containment problem instances: a tree (a) and two networks, one (b) does contain the tree, and one (c) does not. Leaves are labeled with letters (representing a set of taxa). The mapping between the edges of the tree (a) and the paths of the network (b) (as explained in Section 3) is depicted with the dashed curves with of corresponding colors. For the second network (c) no such mapping exists.

Because matching the leaves (species names) between the tree and the network is structurally constrained, this problem is NP-complete in the general case. Exact algorithms scale exponentially, making them unusable for large networks with many species.

Methods

The authors propose Combine-GNN, an approximate, deep-learning-based solver. Instead of processing the tree and network separately and computing a distance metric (a common approach in graph matching), they structurally fuse them.

  1. The Display Graph: The given network and tree are combined into a single larger graph where corresponding leaves (species) are merged and shared.
  2. Preserving Anonymity for Generalization: To ensure the model can generalize to species it has never seen before, the actual text labels of the leaves are discarded. Instead, the structural fusion itself implicitly forces the GNN to respect leaf alignment.
  3. Dir-GNN Architecture: Phylogenetic graphs are inherently directed. Standard GNNs struggle here because leaves have an out-degree of zero and cannot pass messages backward. The authors adopt Dir-GNN, which performs bi-directional message passing but maintains separate learnable weights for forward and backward edge directions.
  4. Embedding and Prediction: Node features capture basic structural properties (in/out-degrees and one-hot encoded node origins: leaf, network, or tree). The model passes these through multiple GNN layers, concatenates multi-scale node embeddings (Jumping Knowledge style), applies a max-pooling readout to get a graph-wide embedding, and uses a Multilayer Perceptron (MLP) to output a binary prediction: contained or not contained.
Figure 2: The schematic illustration of our approach (Combine-GNN). To solve a tree containment problem for the given network and tree, we start by combining them in a single graph such that the leaves are shared, respecting their labels. Then, a GNN is applied. We note that the input node features do not contain the leaves’ labels. The GNN consists of multiple layers, then the obtained embeddings are concatenated, and a node aggregation (graph readout) is applied. Finally, an MLP is used to produce the final prediction.

Datasets

The approach was evaluated on both synthetic and real-world data:

  • Synthetic Data: Generated using a Lateral Gene Transfer (LGT) simulator. Positive instances were true subgraphs; negative instances were generated by applying structural modifications called "tail moves." Datasets scaled from 5 up to 100 leaves, with 10,000 training samples per setup.
  • Real-World Data: Constructed using a benchmark dataset of bacterial and archaeal gene trees. The networks were built to minimize reticulation nodes, and negative examples were generated via tail moves. This dataset was strictly reserved for validation and testing to evaluate out-of-distribution generalization.

Key Insights and Ideas

  • The Power of Structural Fusion: Fusing the two graphs into a display graph bypasses the need for complex node-to-node similarity matrices. The network structure itself acts as the constraint.
  • Inductive Generalization: By omitting explicit leaf labels and focusing purely on topological properties and node origins, the GNN gains true inductive capabilities. It learns the rules of containment rather than memorizing specific graph sizes.
  • Direction Matters: Ablation studies proved that treating the graphs as undirected significantly harms performance. Retaining edge directionality via Dir-GNN is essential for capturing evolutionary flow.

Key Results

  • High Accuracy: Combine-GNN achieved an average balanced accuracy of 97.0% in transductive settings and 95.8% in inductive settings on synthetic data.
  • Robust Scaling: When trained on small instances (5–20 leaves) and tested on much larger instances (up to 100 leaves), the balanced accuracy remained remarkably stable, staying above 90%.
  • Sublinear Inference Speed: While the exact mathematical solver (BOTCH) scales exponentially, Combine-GNN demonstrated an empirical inference time complexity of just $\mathcal{O}(N^{0.21})$, offering massive speedups for large graphs.
  • Real-World Transfer: Despite being trained purely on synthetic data, Combine-GNN generalized well to real-world bacterial/archaeal data, achieving an accuracy of 79.8% and substantially outperforming XGBoost and Siamese GNN baselines.

Limitations and Future Work

While Combine-GNN is highly accurate and fast, it is an approximate solver and a binary classifier. It answers if a tree is contained, but it does not output the actual mathematical mapping (the embedding path) between the tree and the network.

The authors note that performance drops slightly as the complexity (percentage of reticulation nodes) increases. Future work will focus on extending this architecture to output explicit node-to-node mappings for solution verification, adapting the method for non-binary phylogenetic networks, and exploring related phylogenetic challenges like the hybridization problem.

Summary updated

BibTeX
@article{dushatskiy2024solving,
  author = {Arkadiy Dushatskiy and Esther Julien and Leen Stougie and Leo van Iersel},
  title = {{Solving the Tree Containment Problem Using Graph Neural Networks}},
  journal = {Accepted by TMLR},
  year = {2024},
  url = {https://openreview.net/forum?id=nK5MazeIpn},
}
Figure