18 #include <tudocomp/ds/STInterface.hpp> 34 template<
typename size_type = u
int>
38 typedef STNode node_type;
46 STNode(
int s,
int e = 0) : start(s), end (e) {}
51 struct STLeaf : STNode {
55 STLeaf(
int s,
int e = 0) : STNode(s,e){}
61 struct STInnerNode : STNode {
67 std::unordered_map<char, STNode*> child_nodes;
69 STInnerNode* suffix_link;
73 STInnerNode(
int s,
int e = 0) : STNode(s,e){ suffix_link = NULL; child_nodes.reserve(6);}
75 virtual ~STInnerNode(){}
84 inline void add_child(node_type node, size_type start, size_type suffix_beg){
86 STLeaf child = STLeaf(start,0);
87 child.suffix = suffix_beg;
95 inline node_type
split_edge(node_type parent, node_type child, size_type edge_len){
109 inline size_type
get_start(node_type node){
return start[node];}
110 inline size_type
get_end(node_type node){
return end[node];}
130 inline std::vector<node_type>
get_child(node_type node){
157 std::stringstream ss ;
179 uint child = first_child[node];
183 child=next_sibling[child];
Contains the text compression and encoding framework.
node_type get_child(node_type node, char c)
NaivST(io::InputView &input)
size_type get_tree_size()
node_type get_suffix_link(node_type node)
size_type get_end(node_type node)
size_type get_edge_length(node_type node)
size_type get_suffix(node_type node)
node_type split_edge(node_type parent, node_type child, size_type edge_len)
std::vector< node_type > get_child(node_type node)
void set_suffix_link(node_type from_node, node_type to_node)
void add_child(node_type node, size_type start, size_type suffix_beg)
size_type get_start(node_type node)
bool is_leaf(node_type node)
std::string get_string_of_edge(uint node)
void print_tree(uint node, std::string depth)