Graph classification is a cornerstone of modern data science, particularly in chemoinformatics and bioinformatics. A common approach involves representing graphs through their frequent subgraphs—recurring structural motifs that characterize different classes of data. However, this method faces a significant "computational wall." Finding all frequent subgraphs in a large database is computationally intensive, and checking if a new graph contains these patterns (subgraph isomorphism) is an NP-complete problem.
The Problem: The Computational Bottleneck
Traditional frequent subgraph mining (FSM) algorithms struggle with two main bottlenecks. First, the search space for patterns grows exponentially with graph size. Second, the embedding phase—where graphs are mapped to feature vectors based on pattern presence—requires numerous subgraph isomorphism tests. To maintain efficiency, researchers often restrict patterns to small sizes or specific graph classes, which can limit the expressive power of the resulting models.
Proposed Solution: Probabilistic Frequent Subtrees
In their 2018 paper published in Machine Learning, Welke, Horváth, and Wrobel propose a novel workaround: "probabilistic frequent subtrees." Instead of mining general subgraphs directly, the authors suggest sampling a small number ($k$) of random spanning trees from each graph in the database.
Methods and Innovations
The core of the approach lies in shifting the problem from general graphs to forests of spanning trees.
- Random Spanning Tree Sampling: For each graph $G$ in the database $\mathcal{D}$, the algorithm samples $k$ spanning trees uniformly at random. The union of these trees forms a forest $\mathfrak{S}_k(G)$.
- Efficient Mining: Mining frequent subtrees in forests is significantly more efficient than mining subgraphs in general graphs. It can be done with polynomial delay, making the mining process computationally tractable even for large datasets.
- Probabilistic Matching: When embedding a new graph, the algorithm checks if a pattern is a subtree of the graph’s sampled spanning trees. This introduces a "one-sided error": while some matches might be missed, any match found is guaranteed to exist in the original graph. The probability of inclusion increases with the number of trees $k$ and the "importance" (frequency within the spanning tree distribution) of the pattern.
- Poset-based Optimization: The authors leverage the fact that subgraph isomorphism induces a partial order (poset). If a specific tree pattern does not match a graph, none of its super-trees (larger trees containing it) will match either. They developed Greedy and BinarySearch algorithms to navigate this poset, effectively pruning the search space and reducing the number of required isomorphism tests by up to 80%.
Experimental Evaluation
The researchers evaluated the performance of probabilistic frequent subtrees on several standard molecular benchmarks (MUTAG, PTC, NCI1, NCI109, NCI-HIV, and ZINC) and artificial sparse graphs generated via the Erdős-Rényi model.
Key Results and Insights
The experiments yielded several critical insights:
- Speed: The probabilistic method is orders of magnitude faster than exhaustive FSM. On datasets where standard algorithms took over 24 hours, the new approach finished in less than a second.
- Pattern Recovery: With a modest $k=10$, the algorithm recovered 75-90% of the frequent patterns found by exhaustive methods.
- Predictive Performance: Despite being a probabilistic approximation, the method achieved classification accuracy (AUC) very close to exhaustive methods. For instance, on the NCI109 dataset, it reached an AUC of ~81.7%, compared to ~82.3% for the full FSG approach.
- The "Skeleton" Hypothesis: A few random spanning trees appear to capture enough of a graph's structural "essence" for effective classification, suggesting that the full complexity of the graph is often redundant for these tasks.
Conclusion and Future Work
The probabilistic frequent subtree approach offers a powerful trade-off between computational efficiency and predictive power. By prioritizing "soundness over completeness"—ensuring found patterns are real even if some are missed—the authors unlock polynomial-time algorithms for previously intractable problems.
While the method is currently limited to tree patterns and may miss critical cycles (like benzene rings) unless they are represented as paths, its speed and accuracy make it a compelling choice for large-scale graph mining. Future research may focus on extending this sampling logic to directed graphs or developing even faster subtree isomorphism tests.
Reference: Welke, P., Horváth, T. & Wrobel, S. (2018). Probabilistic frequent subtrees for efficient graph classification and retrieval. Machine Learning, 107(11), 1847–1873. https://doi.org/10.1007/s10994-017-5688-7
Summary updated