Пример #1
0
	inline node_type first_child()
	{
		if (m_stack_cache != nullptr and m_stack_size < cache_size) // push node to the stack
			m_stack_cache[m_stack_size] = m_v;
		m_stack_size++;
		return m_cst->select_child(m_v, 1);
	}
Пример #2
0
	//! Prefix increment of the iterator.
	iterator& operator++()
	{
		if (!m_valid) return *this;
		if (m_queue.empty()) {
			m_valid = false;
			return *this;
		}
		value_type v = m_queue.front();
		m_queue.pop();
		value_type child = m_cst->select_child(v, 1);
		while (m_cst->root() != child) {
			m_queue.push(child);
			child = m_cst->sibling(child);
		}
		return *this;
	}
Пример #3
0
void test_cst_1th_child_operation(const Cst& cst, typename Cst::size_type times=1000000, 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);

    node_type c;  // for 1th_child node
    size_type cnt=0;
    write_R_output("cst","1th_child","begin",nodes.size(),cnt);
    for (size_type i=0; i<nodes.size(); ++i) {
        c = cst.select_child(nodes[i], 1);
        if (c==cst.root())
            ++cnt;
    }
    write_R_output("cst","1th_child","end",nodes.size(),cnt);
}