forked from simongog/sdsl-lite
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode_iterator.cpp
More file actions
39 lines (35 loc) · 829 Bytes
/
node_iterator.cpp
File metadata and controls
39 lines (35 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <sdsl/suffix_trees.hpp>
#include <iostream>
using namespace sdsl;
using namespace std;
template<class t_cst>
void output_node(const typename t_cst::node_type& v, const t_cst& cst)
{
cout << cst.depth(v) << "-[" << cst.lb(v) << ","
<< cst.rb(v) << "]" << endl;
}
template<class t_cst>
void run()
{
t_cst cst;
construct_im(cst, "ananas", 1);
for (auto v : cst) {
output_node(v, cst);
}
cout<<"--"<<endl;
auto v = cst.select_leaf(2);
for (auto it = cst.begin(v); it != cst.end(v); ++it) {
output_node(*it, cst);
}
cout<<"--"<<endl;
v = cst.parent(cst.select_leaf(4));
for (auto it = cst.begin(v); it != cst.end(v); ++it) {
output_node(*it, cst);
}
cout<<"---"<<endl;
}
int main()
{
run<cst_sct3<>>();
run<cst_sada<>>();
}