//===- llvm/ADT/SuffixTree.h - Tree for substrings --------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // A data structure for fast substring queries. // // Suffix trees represent the suffixes of their input strings in their leaves. // A suffix tree is a type of compressed trie structure where each node // represents an entire substring rather than a single character. Each leaf // of the tree is a suffix. // // A suffix tree can be seen as a type of state machine where each state is a // substring of the full string. The tree is structured so that, for a string // of length N, there are exactly N leaves in the tree. This structure allows // us to quickly find repeated substrings of the input string. // // In this implementation, a "string" is a vector of unsigned integers. // These integers may result from hashing some data type. A suffix tree can // contain 1 or many strings, which can then be queried as one large string. // // The suffix tree is implemented using Ukkonen's algorithm for linear-time // suffix tree construction. Ukkonen's algorithm is explained in more detail // in the paper by Esko Ukkonen "On-line construction of suffix trees. The // paper is available at // // https://www.cs.helsinki.fi/u/ukkonen/SuffixT1withFigs.pdf //===----------------------------------------------------------------------===// #ifndef LLVM_SUPPORT_SUFFIXTREE_H #define LLVM_SUPPORT_SUFFIXTREE_H #include "llvm/ADT/ArrayRef.h" #include "llvm/Support/Allocator.h" #include "llvm/Support/SuffixTreeNode.h" namespace llvm { class SuffixTree { … }; } // namespace llvm #endif // LLVM_SUPPORT_SUFFIXTREE_H