On modification of Boyer-Moore-horspool's algorithm for tree pattern matching in linearised trees

Jan Travnicek (Corresponding author), Jan Janousek, Borivoj Melichar, Loek Cleophas

    Research output: Contribution to journalArticleAcademicpeer-review

    Abstract

    Tree pattern matching on ordered trees is an important problem in Computer Science. Ordered trees can be represented as strings with additional properties via various linearisations. We present a backward tree pattern matching algorithm for ordered trees for various linear representations of trees and tree patterns. The algorithm adaptations find all occurrences of a single given tree pattern which match an input tree regardless of the chosen linearisation. The algorithms preserve the properties and advantages of standard backward string pattern matching using Boyer-Moore-Horspool's bad character shift heuristics. The number of symbol comparisons in the backward tree pattern matching can be sublinear in the size of the input tree. As in the case of the string version of Boyer-Moore-Horspool's matching algorithm, the size of the bad character shift table used by the algorithm is linear in the size of the alphabet. We compare the algorithm adaptations with the algorithm using originally chosen linear representation and with the best performing previously existing algorithms based on (non-linearised) tree pattern matching using finite tree automata or stringpath matchers. We show that the presented backward tree pattern matching algorithms outperform the non-linearising ones for single pattern matching and they perform among themselves comparably.

    Original languageEnglish
    Pages (from-to)60-90
    Number of pages31
    JournalTheoretical Computer Science
    Volume830-831
    DOIs
    Publication statusPublished - 24 Aug 2020

    Keywords

    • Backward pattern matching
    • Tree linearisation
    • Tree pattern matching
    • Tree processing

    Cite this