Constrained Approximate Subtree Matching by Finite Automata

Processing tree data structures usually requires a pushdown automaton as a model of computation. Therefore, it is interesting that a finite automaton can be used to solve the constrained approximate subtree pattern matching problem. A systematic approach to the construction of such matcher by finite automaton, which reads input trees in prefix bar notation, is presented. Given a tree pattern and an input tree with m and n nodes, respectively, the nondeterministic finite automaton for the pattern is constructed and it is able to find all occurrences of the pattern to subtrees of the input tree with maximum given distance k. The distance between the pattern and subtrees of an input tree is measured by minimal number of restricted tree edit operations, called leaf nodes edit operations. The corresponding deterministic finite automaton finds all occurrences in time O(n) and has O(|A|m) states, where A is an alphabet containing all possible node labels. Note that the size is not exponential in the number of nodes of the tree pattern but only in the number of errors. In practise, the number of errors is expected to be a small constant that is much smaller than the size of the pattern. To achieve better space complexity, it is also shown how dynamic programming approach can be used to simulate the nondeterministic automaton. The space complexity of this approach is O(m), while the time complexity is O(mn).

[1]  Fabrizio Luccio,et al.  Simple Solutions for Approximate Tree Matching Problems , 1991, TAPSOFT, Vol.1.

[2]  Moni Naor,et al.  Computer Analysis of Images and Patterns , 1989, Lecture Notes in Computer Science.

[3]  Philip Bille,et al.  A survey on tree edit distance and related problems , 2005, Theor. Comput. Sci..

[4]  Borivoj Melichar Approximate String Matching by Finite Automata , 1995, CAIP.

[5]  Kuo-Chung Tai,et al.  The Tree-to-Tree Correction Problem , 1979, JACM.

[6]  Alexander Meduna,et al.  Pattern matching in tree structures , 2014 .

[7]  Stanley M. Selkow,et al.  The Tree-to-Tree Editing Problem , 1977, Inf. Process. Lett..

[8]  S. Rao Kosaraju,et al.  Efficient tree pattern matching , 1989, 30th Annual Symposium on Foundations of Computer Science.

[9]  Jan Zdárek,et al.  Simple tree pattern matching for trees in the prefix bar notation , 2010, Discret. Appl. Math..

[10]  Shin-Yee Lu A Tree-to-Tree Distance and Its Application to Cluster Analysis , 1979, IEEE Transactions on Pattern Analysis and Machine Intelligence.

[11]  Kaizhong Zhang,et al.  Approximate Tree Matching in the Presence of Variable Length Don't Cares , 1994, J. Algorithms.

[12]  Christoph M. Hoffmann,et al.  Pattern Matching in Trees , 1982, JACM.

[13]  Erik D. Demaine,et al.  An optimal decomposition algorithm for tree edit distance , 2006, TALG.

[14]  Irena Holubová,et al.  Refinement Correction Strategy for Invalid XML Documents and Regular Tree Grammars , 2014, DEXA.

[15]  Richard Cole,et al.  Tree Pattern Matching to Subset Matching in Linear Time , 2003, SIAM J. Comput..

[16]  Maxime Crochemore,et al.  Automata for Matching Patterns , 1997, Handbook of Formal Languages.