# Spec HmmGraph
A grap representing a Hidden Markov Model (HMM).

Extends | Graph
All Extended | Graph
All Impl'd | AssignableConcept, ContainerConcept, DestructibleConcept
Defined in | <seqan/graph_types.h>
Signature | `template <[typename TAlphabet[, typename TCargo[, typename TSpec]]]> class Graph<Hmm<TAlphabet, TCargo, TSpec> >;`

## Template Parameters

`TAlphabet` | The alphabet of the HMM. Default: Dna.
`TCargo` | The edge cargos. Default: `void`.
`TSpec` | The specialization type. Default: `Default`. Use `WithoutEdgeIds` here to omit edge ids. NB: if edges do not store ids then external property maps do not work.

## Member Function Overview

### Member Functions Inherited From AssignableConcept

- `operator=`

## Interface Function Overview

- `void assignBeginState(hmm, v);`
  Assigns a begin state.
- `void assignEmissionProbability(hmm, state, symbol, eProb);`
  Assigns a new emission probability.
- `void assignEndState(hmm, v);`
  Assigns a end state.
- `void assignSilentStatus(hmm, v, silent);`
  Assigns a silent status to a state.
- `void assignTransitionProbability(hmm, state1, state2, prob);, void assignTransitionProbability(hmm, e, prob);`
  Assigns a new transition probability to an existing edge.
- `TVertexDescriptor beginState(hmm);`
  Return a reference to the begin state vertex descriptor.
- `TCargo emissionProbability(hmm, state, symbol);`
  Returns a reference to the emissions probability.
- `TVertexDescriptor endState(hmm);`
  Return a reference to the end state vertex descriptor.
- `TVertexDescriptor getBeginState(hmm);`
  Return the begin state vertex descriptor.
- `TCargo getEmissionProbability(hmm, state, symbol);`
  Returns the emissions probability.
- `TVertexDescriptor getEndState(hmm);`
  Return the end state vertex descriptor.
- `TCargo getTransitionProbability(hmm, state1, state2);, TCargo getTransitionProbability(hmm, e);`
  Returns the transition probability, stored as the cargo.
- `bool isSilent(hmm, v);`
  Indicates whether a state is silent or not.
- `TBoolRef silentStatus(hmm, v);`
  Return reference to silent status flag.
- `TCargo getTransitionProbability(hmm, state1, state2);, TCargo getTransitionProbability(hmm, e);`
  Returns a reference to transition probability, stored as the cargo.

### Interface Functions Inherited From Graph

- `addEdge`
- `addEdges`
- `addVertex`
- `assignEdgeMap`
- `assignVertexMap`
- `clear`
- `clearEdges`
- `clearVertices`
- `degree`
- `empty`
- `findEdge`
- `getAdjacencyMatrix`
- `getNil`
- `getVertexAdjacencyVector`
- `inDegree`
- `numEdges`
- `numVertices`
- `outDegree`
- `removeEdge`
- `removeInEdges`
- `removeOutEdges`
- `removeVertex`
- `resizeEdgeMap`
- `resizeVertexMap`
- `sourceVertex`
- `targetVertex`
- `transpose`
- `write`

### Interface Functions Inherited From AssignableConcept

- `assign`
- `set`
- `move`

### Interface Functions Inherited From ContainerConcept

- `begin`
- `end`
- `length`
- `empty`
- `swap`
- `writeValue`
- `write`
- `getObjectId`
- `moveValue`
- `append`
- `appendValue`
- `shrinkToFit`
- `directionIterator`

## Interface Metafunction Overview

### Interface Metafunctions Inherited From Graph

- `Cargo`
- `EdgeDescriptor`
- `EdgeIdHandler`
- `EdgeType`
- `Size`
- `VertexIdHandler`

### Interface Metafunctions Inherited From ContainerConcept

- `DefaultGetIteratorSpec`
- `DefaultIteratorSpec`
- `Difference`
- `DirectionIterator`
- `GetValue`
- `Iterator`
- `Position`
- `Reference`
- `Size`
- `Value`

## Detailed Description

An HMM is a directed graph with edges labeled with transition probabilities and emission profiles for each vertex. Vertices correspond to states in an HMM.

## Interface Functions Detail

### `void assignBeginState(hmm, v);`

Assigns a begin state.

#### Parameters

`hmm` | The HmmGraph to assign the begin state of.
`v` | The descriptor of the vertex to assign as begin state.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `void assignEmissionProbability(hmm, state, symbol, eProb);`

Assigns a new emission probability.

#### Parameters

`hmm` | The HmmGraph to query.
`state` | A vertex descriptor with the source state.
`symbol` | The symbol. Type: `TAlphabet`.
`eProb` | Emission probability to assign.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `void assignEndState(hmm, v);`

Assigns a end state.

#### Parameters

`hmm` | The HmmGraph to assign the end state of.
`v` | The descriptor of the vertex to assign as end state.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `void assignSilentStatus(hmm, v, silent);`

Assigns a silent status to a state.

#### Parameters

`hmm` | The HmmGraph to assign the silent status in.
`v` | Vertex descriptor of the state to assign silent status.
`silent` | A bool with the silent status.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `void assignTransitionProbability(hmm, state1, state2, prob); void assignTransitionProbability(hmm, e, prob);`

Assigns a new transition probability to an existing edge.

#### Parameters

`hmm` | The HmmGraph to get transition probability for.
`state1` | Assign transition probability from start state1.
`state2` | Assign probability to target state2.
`e` | Assign probability to edge with this edge descriptor.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `TVertexDescriptor beginState(hmm);`

Return a reference to the begin state vertex descriptor.

#### Parameters

`hmm` | The HmmGraph to get the vertex descriptor of.

#### Returns

`TVertexDescriptor` | A reference to the begin state vertex descriptor.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `TCargo emissionProbability(hmm, state, symbol);`

Returns a reference to the emissions probability.

#### Parameters

`hmm` | The HmmGraph to query.
`state` | A vertex descriptor with the source state.
`symbol` | The symbol. Type: `TAlphabet`.

#### Returns

`TCargo` | Reference to the emission probability.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `TVertexDescriptor endState(hmm);`

Return a reference to the end state vertex descriptor.

#### Parameters

`hmm` | The HmmGraph to get the vertex descriptor of.

#### Returns

`TVertexDescriptor` | A reference to the end state vertex descriptor.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `TVertexDescriptor getBeginState(hmm);`

Return the begin state vertex descriptor.

#### Parameters

`hmm` | The HmmGraph to get the vertex descriptor of.

#### Returns

`TVertexDescriptor` | The begin state vertex descriptor.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `TCargo getEmissionProbability(hmm, state, symbol);`

Returns the emissions probability.

#### Parameters

`hmm` | The HmmGraph to query.
`state` | A vertex descriptor with the source state.
`symbol` | The symbol. Type: `TAlphabet`.

#### Returns

`TCargo` | The emission probability.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `TVertexDescriptor getEndState(hmm);`

Return the end state vertex descriptor.

#### Parameters

`hmm` | The HmmGraph to get the vertex descriptor of.

#### Returns

`TVertexDescriptor` | The end state vertex descriptor.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `TCargo getTransitionProbability(hmm, state1, state2); TCargo getTransitionProbability(hmm, e);`

Returns the transition probability, stored as the cargo.

#### Parameters

`hmm` | The HmmGraph to get transition probability for.
`state1` | Return transition probability from start state1.
`state2` | Return transition probability to target state2.
`e` | An edge descriptor.

#### Returns

`TCargo` | Return the transition probability.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `bool isSilent(hmm, v);`

Indicates whether a state is silent or not.

#### Parameters

`hmm` | The HmmGraph to query.
`v` | Vertex descriptor of the state to query.

#### Returns

`bool` | true if the state is silent and false if not.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `TBoolRef silentStatus(hmm, v);`

Return reference to silent status flag.

#### Parameters

`hmm` | The HmmGraph to assign the silent status in.
`v` | Vertex descriptor of the state to assign silent status.

#### Returns

`TBoolRef` | Reference to bool silent status flag.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `TCargo getTransitionProbability(hmm, state1, state2); TCargo getTransitionProbability(hmm, e);`

Returns a reference to transition probability, stored as the cargo.

#### Parameters

`hmm` | The HmmGraph to get transition probability for.
`state1` | Return transition probability from start state1.
`state2` | Return transition probability to target state2.
`e` | An edge descriptor.

#### Returns

`TCargo` | Returns a reference to the transition probability.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

#### Dox Sources

    /*!
     * @class HmmGraph
     *
     * @extends Graph
     *
     * @headerfile <seqan/graph_types.h>
     *
     * @brief A grap representing a Hidden Markov Model (HMM).
     *
     * @signature template <[typename TAlphabet[, typename TCargo[, typename
     *            TSpec]]]> class Graph<Hmm<TAlphabet, TCargo, TSpec> >;
     *
     * @tparam TAlphabet The alphabet of the HMM. Default: @link Dna @endlink.
     * @tparam TCargo The edge cargos. Default: <tt>void</tt>.
     * @tparam TSpec The specialization type. Default: <tt>Default</tt>. Use
     *               <tt>WithoutEdgeIds</tt> here to omit edge ids. NB: if edges do
     *               not store ids then external property maps do not work.
     *
     * An HMM is a directed graph with edges labeled with transition probabilities
     * and emission profiles for each vertex. Vertices correspond to states in an
     * HMM.
     *
     * @fn HmmGraph#assignBeginState
     *
     * @headerfile <seqan/graph_types.h>
     *
     * @brief Assigns a begin state.
     *
     * @signature void assignBeginState(hmm, v);
     *
     * @param[in,out] hmm The @link HmmGraph @endlink to assign the begin state of.
     * @param[in] v The descriptor of the vertex to assign as begin state.
     *
     * @fn HmmGraph#assignEndState
     *
     * @headerfile <seqan/graph_types.h>
     *
     * @brief Assigns a end state.
     *
     * @signature void assignEndState(hmm, v);
     *
     * @param[in,out] hmm The @link HmmGraph @endlink to assign the end state of.
     * @param[in] v The descriptor of the vertex to assign as end state.
     *
     * @fn HmmGraph#beginState
     *
     * @brief Return a reference to the begin state vertex descriptor.
     *
     * @signature TVertexDescriptor beginState(hmm);
     *
     * @param[in] hmm The @link HmmGraph @endlink to get the vertex descriptor of.
     *
     * @return TVertexDescriptor A reference to the begin state vertex descriptor.
     *
     * @fn HmmGraph#endState
     *
     * @brief Return a reference to the end state vertex descriptor.
     *
     * @signature TVertexDescriptor endState(hmm);
     *
     * @param[in] hmm The @link HmmGraph @endlink to get the vertex descriptor of.
     *
     * @return TVertexDescriptor A reference to the end state vertex descriptor.
     *
     * @fn HmmGraph#getBeginState
     *
     * @brief Return the begin state vertex descriptor.
     *
     * @signature TVertexDescriptor getBeginState(hmm);
     *
     * @param[in] hmm The @link HmmGraph @endlink to get the vertex descriptor of.
     *
     * @return TVertexDescriptor The begin state vertex descriptor.
     *
     * @fn HmmGraph#getEndState
     *
     * @brief Return the end state vertex descriptor.
     *
     * @signature TVertexDescriptor getEndState(hmm);
     *
     * @param[in] hmm The @link HmmGraph @endlink to get the vertex descriptor of.
     *
     * @return TVertexDescriptor The end state vertex descriptor.
     *
     * @fn HmmGraph#getTransitionProbability
     *
     * @brief Returns the transition probability, stored as the cargo.
     *
     * @signature TCargo getTransitionProbability(hmm, state1, state2);
     * @signature TCargo getTransitionProbability(hmm, e);
     *
     * @param[in] hmm The @link HmmGraph @endlink to get transition probability for.
     * @param[in] state1 Return transition probability from start state1.
     * @param[in] state2 Return transition probability to target state2.
     * @param[in] e An edge descriptor.
     *
     * @return TCargo Return the transition probability.
     *
     * @fn HmmGraph#transitionProbability
     *
     * @brief Returns a reference to transition probability, stored as the cargo.
     *
     * @signature TCargo getTransitionProbability(hmm, state1, state2);
     * @signature TCargo getTransitionProbability(hmm, e);
     *
     * @param[in] hmm The @link HmmGraph @endlink to get transition probability for.
     * @param[in] state1 Return transition probability from start state1.
     * @param[in] state2 Return transition probability to target state2.
     * @param[in] e An edge descriptor.
     *
     * @return TCargo Returns a reference to the transition probability.
     *
     * @fn HmmGraph#assignTransitionProbability
     *
     * @brief Assigns a new transition probability to an existing edge.
     *
     * @signature void assignTransitionProbability(hmm, state1, state2, prob);
     * @signature void assignTransitionProbability(hmm, e, prob);
     *
     * @param[in] hmm The @link HmmGraph @endlink to get transition probability for.
     * @param[in] state1 Assign transition probability from start state1.
     * @param[in] state2 Assign probability to target state2.
     * @param[in] e Assign probability to edge with this edge descriptor.
     *
     * @fn HmmGraph#getEmissionsProbability
     *
     * @brief Returns the emissions probability.
     *
     * @signature TCargo getEmissionProbability(hmm, state, symbol);
     *
     * @param[in] hmm The @link HmmGraph @endlink to query.
     * @param[in] state A vertex descriptor with the source state.
     * @param[in] symbol The symbol. Type: <tt>TAlphabet</tt>.
     *
     * @return TCargo The emission probability.
     *
     * @fn HmmGraph#emissionProbability
     *
     * @brief Returns a reference to the emissions probability.
     *
     * @signature TCargo emissionProbability(hmm, state, symbol);
     *
     * @param[in] hmm The @link HmmGraph @endlink to query.
     * @param[in] state A vertex descriptor with the source state.
     * @param[in] symbol The symbol. Type: <tt>TAlphabet</tt>.
     *
     * @return TCargo Reference to the emission probability.
     *
     * @fn HmmGraph#assignEmissionsProbability
     *
     * @brief Assigns a new emission probability.
     *
     * @signature void assignEmissionProbability(hmm, state, symbol, eProb);
     *
     * @param[in,out] hmm The @link HmmGraph @endlink to query.
     * @param[in] state A vertex descriptor with the source state.
     * @param[in] symbol The symbol. Type: <tt>TAlphabet</tt>.
     * @param[in] eProb Emission probability to assign.
     *
     * @fn HmmGraph#assignSilentStatus
     *
     * @brief Assigns a silent status to a state.
     *
     * @signature void assignSilentStatus(hmm, v, silent);
     *
     * @param[in] hmm The HmmGraph to assign the silent status in.
     * @param[in] v Vertex descriptor of the state to assign silent status.
     * @param[in] silent A bool with the silent status.
     *
     * @fn HmmGraph#silentStatus
     *
     * @brief Return reference to silent status flag.
     *
     * @signature TBoolRef silentStatus(hmm, v);
     *
     * @param[in] hmm The HmmGraph to assign the silent status in.
     * @param[in] v Vertex descriptor of the state to assign silent status.
     *
     * @return TBoolRef Reference to bool silent status flag.
     *
     * @fn HmmGraph#isSilent
     *
     * @brief Indicates whether a state is silent or not.
     *
     * @signature bool isSilent(hmm, v);
     *
     * @param[in] hmm The HmmGraph to query.
     * @param[in] v Vertex descriptor of the state to query.
     *
     * @return bool true if the state is silent and false if not.
     */