File: standalone_lcp.cpp

package info (click to toggle)
libsdsl 2.1.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster
  • size: 3,980 kB
  • sloc: cpp: 42,286; makefile: 1,171; ansic: 318; sh: 201; python: 27
file content (29 lines) | stat: -rw-r--r-- 664 bytes parent folder | download | duplicates (16)
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
#include <iostream>
#include <sdsl/lcp.hpp>
#include <sdsl/suffix_arrays.hpp>

using namespace std;
using namespace sdsl;

int main(int argc, char* argv[])
{
    if (argc < 2) {
        cout << "Usage: " << argv[0] << " file" << endl;
        return 1;
    }
    string file = argv[1];

    cache_config cc(false); // do not delete temp files after csa construction
    csa_wt<> csa;
    construct(csa, file, 1);

    cc.delete_files = true; // delete temp files after lcp construction
    lcp_wt<> lcp;
    construct(lcp, file, 1);

    if (csa.size() < 1000) {
        cout << csa << endl;
        cout << "-------" << endl;
        cout << lcp << endl;
    }
}