# Concept StringTreeConcept
And index that can be accessed as suffix or prefix tree/trie.

Defined in | <seqan/index.h>
Signature | `StringTreeConcept<T>`

## Interface Function Overview

- `TIterator begin(index, tag);`
  Returns an iterator pointing to the root node of a string tree index.
- `void resizeVertexMap(pm, index);`
  Initializes a vertex map.

## Interface Metafunction Overview

- `Iterator<TIndex, TSpec>::Type;`
  Returns the type of an iterator to traverse the nodes of a string tree.
- `VertexDescriptor<TIndex>::Type;`
  Returns the type of an object that represents a string tree node.

## Interface Functions Detail

### `TIterator begin(index, tag);`

Returns an iterator pointing to the root node of a string tree index.

#### Parameters

`index` | An index that implements the StringTreeConcept. Types: IndexEsa, IndexDfi, IndexWotd, FMIndex.
`tag` | The specialisation of the iterator to be returned by the function. Types: VSTreeIterator

#### Returns

`TIterator` | Returns an iterator pointing to the root node of the virtual string tree of the index. The type is the result of `Iterator<Index<TText, TIndexSpec>, TSpec >::Type`

#### 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.

    #include <seqan/index.h>

    using namespace seqan;

    int main()
    {
        typedef Index<CharString> TIndex;
        TIndex index("TATAA");

        Iterator<TIndex, TopDown<ParentLinks<> > >::Type itDefault;
        itDefault = begin(index, TopDown<ParentLinks<> >());

        while (!atEnd(itDefault))
        {
            std::cout << representative(itDefault) << std::endl;
            goNext(itDefault);
        }

        std::cout << "--------------------------------" << std::endl;

        Iterator<TIndex, TopDown<ParentLinks<Postorder> > >::Type itPostOrder;
        itPostOrder = begin(index, TopDown<ParentLinks<Postorder> >());

        while (!atEnd(itPostOrder))
        {
            std::cout << representative(itPostOrder) << std::endl;
            goNext(itPostOrder);
        }

        return 0;
    }

Demo: demos/dox/index/begin_atEnd_representative.cpp

The output is as follows:

    A
    AA
    ATAA
    TA
    TAA
    TATAA
    --------------------------------
    AA
    ATAA
    A
    TAA
    TATAA
    TA

#### Data Races

Thread safety unknown!

### `void resizeVertexMap(pm, index);`

Initializes a vertex map.

#### Parameters

`pm` | An External Property Map.
`index` | An index with a string tree interface. Types: IndexEsa, IndexWotd

#### Data Races

Thread safety unknown!

## Interface Metafunctions Detail

### `Iterator<TIndex, TSpec>::Type;`

Returns the type of an iterator to traverse the nodes of a string tree.

#### Template Parameters

`TIndex` | The index type.
`TSpec` | The spec type of a VSTreeIterator, e.g. TopDown<> or BottomUp<>.

#### Returns

`Type` | The resulting string tree iterator type.

### `VertexDescriptor<TIndex>::Type;`

Returns the type of an object that represents a string tree node.

#### Template Parameters

`TIndex` | The index type.

#### Returns

`Type` | The resulting vertex descriptor type.

#### Dox Sources

    /*!
     * @concept StringTreeConcept
     *
     * @headerfile <seqan/index.h>
     *
     * @brief And index that can be accessed as suffix or prefix tree/trie.
     *
     * @signature StringTreeConcept<T>
     *
     * @mfn StringTreeConcept#VertexDescriptor
     *
     * @headerfile <seqan/index.h>
     *
     * @brief Returns the type of an object that represents a string tree node.
     *
     * @signature VertexDescriptor<TIndex>::Type;
     *
     * @tparam TIndex The index type.
     *
     * @return Type The resulting vertex descriptor type.
     *
     * @mfn StringTreeConcept#Iterator
     *
     * @headerfile <seqan/index.h>
     *
     * @brief Returns the type of an iterator to traverse the nodes of a string
     *        tree.
     *
     * @signature Iterator<TIndex, TSpec>::Type;
     *
     * @tparam TIndex The index type.
     * @tparam TSpec The spec type of a @link VSTreeIterator @endlink, e.g. @link
     *               TopDownIterator TopDown<>@endlink or @link BottomUpIterator
     *               BottomUp<>@endlink.
     *
     * @return Type The resulting string tree iterator type.
     *
     * @fn StringTreeConcept#resizeVertexMap
     *
     * @headerfile <seqan/index.h>
     *
     * @brief Initializes a vertex map.
     *
     * @signature void resizeVertexMap(pm, index);
     *
     * @param[in,out] pm An External Property Map.
     * @param[in] index An index with a string tree interface. Types: @link IndexEsa
     *                  @endlink, @link IndexWotd @endlink
     *
     * @fn StringTreeConcept#begin
     *
     * @headerfile <seqan/index.h>
     *
     * @brief Returns an iterator pointing to the root node of a string tree index.
     *
     * @signature TIterator begin(index, tag);
     *
     * @param[in] index An index that implements the @link StringTreeConcept
     *                  @endlink. Types: @link IndexEsa @endlink, @link IndexDfi
     *                  @endlink, @link IndexWotd @endlink, @link FMIndex @endlink.
     * @param[in] tag The specialisation of the iterator to be returned by the
     *                function. Types: @link VSTreeIterator @endlink
     *
     * @return TIterator Returns an iterator pointing to the root node of the
     *                   virtual string tree of the index. The type is the result of
     *                   <tt>Iterator<Index<TText, TIndexSpec>, TSpec >::Type</tt>
     *
     * @section Examples
     *
     * The following example shows the usage of the @link StringTreeConcept#begin
     * @endlink function. Note that in the first case @link StringTreeConcept#begin
     * @endlink returns an iterator pointing to the root node, while in the second
     * case @link StringTreeConcept#begin @endlink returns a pointer to the left
     * most node.
     *
     * @include demos/dox/index/begin_atEnd_representative.cpp
     *
     * The output is as follows:
     *
     * @include demos/dox/index/begin_atEnd_representative.cpp.stdout
     */