Function
goDown
Iterates down one edge or a path in a tree.
bool goDown(iterator)
bool goDown(iterator, char)
bool goDown(iterator, text[, lcp])
Include Headers
seqan/index.h
Parameters
iterator
An iterator of a suffix tree.
char
iterator goes down the edge beginning with char.
text
iterator goes down the path representing text. If text ends within an edge, iterator will point to the child-end of this edge.
lcp
A reference of a size type. When goDown returns, lcp contains the length of the longest-common-prefix of text and a path beginning at the iterator node.
Types: Segment, String
Remarks
goDown(iterator) goes down the leftmost edge in the suffix tree, i.e. the edge beginning with the lexicographically smallest character.
Return Values
true if the edge or path to go down exists, otherwise false.
Types: bool
Examples
The following code shows a simple example how the function goDown is used.
1#include <seqan/index.h>
2
3using namespace seqan;
4
5int main ()
6{
7    typedef Index<CharString> TIndex;
8
9    TIndex index("MISSISSIPPI");
10    Iterator<TIndex, TopDown<> >::Type it(index);
11
12    goDown(it, "ISSI");
13    std::cout << "The string " << representative(it) << " occurs " << range(it).i2 - range(it).i1 <<
14                 " times in MISSISSIPPI and has " << repLength(it) << " characters." << std::endl;
15
16    // Note that goDown follows the path STARTING with a given text. It only stops at the next node. Therefore the
17    // output for the following code is the same as above, even though the search string changed.
18    goRoot(it);
19    goDown(it, "ISS");
20
21    std::cout << "The string " << representative(it) << " occurs " << range(it).i2 - range(it).i1 <<
22                 " times in MISSISSIPPI and has " << repLength(it) << " characters." << std::endl;
23
24    return 0;
25}
The string ISSI occurs 2 times in MISSISSIPPI and has 4 characters.
The string ISSI occurs 2 times in MISSISSIPPI and has 4 characters.
SeqAn - Sequence Analysis Library - www.seqan.de
 

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