//===- llvm/ADT/SuffixTreeNode.h - Nodes for SuffixTrees --------*- 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 // //===----------------------------------------------------------------------===// // // This file defines nodes for use within a SuffixTree. // // Each node has either no children or at least two children, with the root // being a exception in the empty tree. // // Children are represented as a map between unsigned integers and nodes. If // a node N has a child M on unsigned integer k, then the mapping represented // by N is a proper prefix of the mapping represented by M. Note that this, // although similar to a trie is somewhat different: each node stores a full // substring of the full mapping rather than a single character state. // // Each internal node contains a pointer to the internal node representing // the same string, but with the first character chopped off. This is stored // in \p Link. Each leaf node stores the start index of its respective // suffix in \p SuffixIdx. //===----------------------------------------------------------------------===// #ifndef LLVM_SUPPORT_SUFFIXTREE_NODE_H #define LLVM_SUPPORT_SUFFIXTREE_NODE_H #include "llvm/ADT/DenseMap.h" namespace llvm { /// A node in a suffix tree which represents a substring or suffix. struct SuffixTreeNode { … }; // A node with two or more children, or the root. struct SuffixTreeInternalNode : SuffixTreeNode { … }; // A node representing a suffix. struct SuffixTreeLeafNode : SuffixTreeNode { … }; } // namespace llvm #endif // LLVM_SUPPORT_SUFFIXTREE_NODE_H