File: storage-visualization.cpp

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

using timer = std::chrono::high_resolution_clock;
using namespace std::chrono;
using namespace sdsl;

int main(int argc, char** argv)
{
    if (argc < 2) {
        cout << "Usage: " << argv[0] << " file" << std::endl;
        cout << " Creates a CST for a byte file and visualizes the space used by the data structure." << std::endl;
        return 1;
    }
    cst_sct3<> cst;
    auto start = timer::now();
    cout << "constructing cst..." << std::endl;
    construct(cst, argv[1], 1);
    cout << "construction cst time in seconds: " << duration_cast<seconds>(timer::now()-start).count() << std::endl;

    std::ofstream ofs("cst-space-usage.html");
    std::cout << "writing storage visualization to cst-space-usage.html" << std::endl;
    sdsl::write_structure<HTML_FORMAT>(cst,ofs);
}