Пример #1
0
void test_cst_dfs_iterator_and_id(Cst& cst, typename Cst::size_type times=1000000, bool output=false)
{
    if (times > 2*cst.nodes()-cst.size())
        times = 2*cst.nodes()-cst.size();
    typedef typename Cst::size_type size_type;
    size_type cnt=0;
    write_R_output("cst","dfs and id","begin",times,cnt);
    typename Cst::const_iterator it = cst.begin();
    if (!output) {
        for (size_type i=0; i<times; ++i, ++it) {
            cnt += cst.id(*it);
        }
    } else {
        for (size_type i=0; i<times; ++i, ++it) {
            size_type id = cst.id(*it);
            std::cerr << id << std::endl;
            cnt += id;
        }
    }
    write_R_output("cst","dfs and id","end",times,cnt);
}
Пример #2
0
void test_cst_id_operation(const Cst& cst, typename Cst::size_type times=100000, uint64_t x=17)
{
    typedef typename Cst::size_type size_type;
    typedef typename Cst::node_type node_type;
    std::vector<node_type> nodes;
    generate_nodes_from_random_leaves(cst, times, nodes, x);

    size_type cnt = 0;
    write_R_output("cst","id","begin",nodes.size(),cnt);
    for (size_type i=0; i < nodes.size(); ++i) {
        cnt += cst.id(nodes[i]);
    }
    write_R_output("cst","id","end",nodes.size(),cnt);
}