Function
begin
Returns an iterator pointing to the root node of the virtual string tree/trie of an index. The only exception are Postorder iterators, where begin returns an iterator pointing to the leftmost node in the tree/trie.
begin(index, tag)
Parameters
index
The index to be traversed
tag
The specialisation of the iterator to be returned by the function.
Return Values
Returns an iterator pointing to the root not of the virtual suffix tree of the index.
Types: The result of Iterator<Index<TText, TIndexSpec>, TSpec >::Type
Member of
Examples
The following example shows the usage of the begin function. Note that in the first case begin returns an iterator pointing to the root node, while in the second case begin returns a pointer to the left most node.
1#include <seqan/index.h>
2
3using namespace seqan;
4
5int main ()
6{
7    typedef Index<CharString> TIndex;
8    TIndex index("TATAA");
9
10    Iterator<TIndex, TopDown<ParentLinks<> > >::Type itDefault;
11    itDefault = begin(index, TopDown<ParentLinks<> >());
12
13    while(!atEnd(itDefault))
14    {
15        std::cout << representative(itDefault) << std::endl;
16        goNext(itDefault);
17    }
18
19    std::cout << "--------------------------------" << std::endl;
20
21    Iterator<TIndex, TopDown<ParentLinks<Postorder> > >::Type itPostOrder;
22    itPostOrder = begin(index, TopDown<ParentLinks<Postorder> >());
23
24    while(!atEnd(itPostOrder))
25    {
26        std::cout << representative(itPostOrder) << std::endl;
27        goNext(itPostOrder);
28    };
29
30    return 0;
31}
A
AA
ATAA
TA
TAA
TATAA
--------------------------------
AA
ATAA
A
TAA
TATAA
TA
SeqAn - Sequence Analysis Library - www.seqan.de
 

Page built @2013/07/11 09:12:35