Skip to main content
QUICK REVIEW

[Paper Review] An A*-algorithm for the Unordered Tree Edit Distance with Custom Costs

Benjamin Paaßen|arXiv (Cornell University)|Jul 26, 2021
Algorithms and Data CompressionComputer Science17 references2 citations
TL;DR

This paper proposes three novel A*-algorithm heuristics for computing the unordered tree edit distance (UTED) with custom cost functions, enabling domain-specific optimization in chemical structure comparison. The heuristics balance computational complexity (linear to cubic) and pruning effectiveness, significantly improving A* search efficiency and reducing regression error in predicting molecular properties when using custom costs—outperforming unit-cost baselines and rivaling polynomial edit distances.

ABSTRACT

The unordered tree edit distance is a natural metric to compute distances between trees without intrinsic child order, such as representations of chemical molecules. While the unordered tree edit distance is MAX SNP-hard in principle, it is feasible for small cases, e.g. via an A* algorithm. Unfortunately, current heuristics for the A* algorithm assume unit costs for deletions, insertions, and replacements, which limits our ability to inject domain knowledge. In this paper, we present three novel heuristics for the A* algorithm that work with custom cost functions. In experiments on two chemical data sets, we show that custom costs make the A* computation faster and improve the error of a 5-nearest neighbor regressor, predicting chemical properties. We also show that, on these data, polynomial edit distances can achieve similar results as the unordered tree edit distance.

Motivation & Objective

  • To address the limitation of existing A* heuristics for unordered tree edit distance, which assume unit costs and cannot leverage domain-specific knowledge.
  • To develop efficient, extensible heuristics that support arbitrary custom cost functions for deletions, insertions, and relabelings.
  • To evaluate whether custom costs improve similarity search performance in chemical structure analysis.
  • To compare the performance of UTED with custom costs against polynomial edit distances in predicting molecular properties.

Proposed method

  • Propose three A* heuristics—h1 (linear), h2 (quadratic), h3 (cubic)—that estimate lower bounds on the edit cost using node label and degree distributions.
  • Design the heuristics to incorporate custom cost functions, such as differences in hydrogen or electron counts between atoms, to guide the search more precisely.
  • Implement the A* algorithm with these heuristics, using dynamic programming to cache intermediate values and reduce redundant computation.
  • Use the heuristics to guide the A* search for UTED, pruning unpromising paths based on the estimated lower bound.
  • Apply the method to two chemical datasets: alkanes (SMILES-represented molecules) and ZINC (drug-like compounds) with custom cost functions.
  • Evaluate performance via 5-nearest neighbor regression on boiling point and chemical stability, comparing UTED with CUTED and TED under unit and custom costs.

Experimental results

Research questions

  • RQ1Which of the proposed heuristics (h1, h2, h3) is fastest, and how do they compare to the state-of-the-art heuristic by Yoshino et al. (2013) for unit costs?
  • RQ2Do custom edit costs improve the performance of similarity search in chemical structure analysis?
  • RQ3How does the unordered tree edit distance (UTED) with custom costs compare to polynomial edit distances (e.g., CUTED, TED) in predicting molecular properties?

Key findings

  • The cubic heuristic (h3) outperforms the state-of-the-art heuristic by Yoshino et al. (2013) in terms of pruning efficiency and scalability, especially on larger trees.
  • On the ZINC dataset, the cubic heuristic with custom costs reduced average runtime to 68.12 ms per distance computation, down from 266.66 ms with unit costs.
  • Custom costs reduced the regression error in 5-nearest neighbor prediction: for ZINC, RMSE dropped from 1.33 ± 0.85 (unit costs) to 1.24 ± 0.87 (custom costs) for UTED.
  • For alkanes, custom costs reduced RMSE from 0.27 ± 0.24 to 0.25 ± 0.24, showing consistent improvement across datasets.
  • Polynomial edit distances (CUTED, TED) achieved similar or better performance than UTED with unit costs, but UTED with custom costs surpassed them, indicating that custom costs are key to performance.
  • The search space size was reduced by up to 75% with custom costs—e.g., from 24,586 to 1,379 partial mappings on ZINC—demonstrating effective pruning.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.