Tree template matching in unranked ordered trees

  • Authors:
  • Michalis Christou;Tomáš Flouri;Costas S. Iliopoulos;Jan JanoušEk;BořIvoj Melichar;Solon P. Pissis;Jan áRek

  • Affiliations:
  • Dept. of Informatics, Kings College London, UK;Dept. of Theoretical Computer Science, Czech Technical University in Prague, Czech Republic;Dept. of Informatics, Kings College London, UK and Dept. of Mathematics & Statistics, University of Western Australia, Australia;Dept. of Theoretical Computer Science, Czech Technical University in Prague, Czech Republic;Dept. of Theoretical Computer Science, Czech Technical University in Prague, Czech Republic;Heidelberg Institute for Theoretical Studies, Germany and Florida Museum of Natural History, University of Florida, USA;Dept. of Theoretical Computer Science, Czech Technical University in Prague, Czech Republic

  • Venue:
  • Journal of Discrete Algorithms
  • Year:
  • 2013

Quantified Score

Hi-index 0.00

Visualization

Abstract

We consider the problem of tree template matching, a type of tree pattern matching, where the tree templates have some of their leaves denoted as ''don@?t care'', and propose a solution based on the bottom-up technique. Specifically, we transform the tree pattern matching problem for unranked ordered trees to a string matching problem, by transforming the tree template and the subject tree to strings representing their postfix bar notation, and then propose a table-driven algorithm to solve it. The proposed algorithm is divided into two phases: the preprocessing and the searching phase. The tree template is preprocessed once, and the searching phase can be applied to many subject trees, without the need of preprocessing the tree template again. Although we prove that the space required for preprocessing is exponential in the size of the tree template in the worst case, we show that for a specific class of tree templates, the space required is linear in the size of the tree template. The time for the searching phase is linear in the size of the subject tree in the worst case. Thus, the algorithm is asymptotically optimal when one needs to search for a given tree template, of constant to logarithmic size, in many subject trees.