# Class Graph
Graph class.

Implements | ContainerConcept
All Subcl's | AlignmentGraph, Automaton, DirectedGraph, HmmGraph, Tree, UndirectedGraph, WordGraph
All Impl'd | AssignableConcept, ContainerConcept, DestructibleConcept
Defined in | <seqan/graph_types.h>
Signature | `template <[typename TSpec]> class Graph;`

## Template Parameters

`TSpec` | The specializing type. Default: Directed<>.

## Member Function Overview

### Member Functions Inherited From AssignableConcept

- `operator=`

## Interface Function Overview

- `TEdgeDescriptor addEdge(g, source, target, label[, cargo]);, TEdgeDescriptor addEdge(g, source, target, cargo);`
  Adds a new edge to a graph, either with or without cargo.
- `void addEdges(graph, edges, size);`
  Shortcut to add multiple edges at once; vertices are created implicitely.
- `TVertexDescriptor addVertex(g);`
  Add a vertex to a graph.
- `void assignEdgeMap(g, pm, prop);`
  Initializes a vertex map with values of an array.
- `void assignVertexMap(g, pm, prop);`
  Initializes a vertex map with values of an array.
- `void clear(g);`
  Remove all edges and vertices from a graph.
- `void clearEdges(g);`
  Removes all edges from a graph.
- `void clearVertices(g);`
  Removes all vertices from a graph.
- `TSize degree(g, v);`
  Return degree of a vertex.
- `bool empty(g);`
  Returns whether there are no vertices and edges in the graph or not.
- `TEdgeDescriptor findEdge(g, v, c);, TEdgeDescriptor findEdge(g, v, w);`
  Finds an edge.
- `void getAdjacencyMatrix(g, matrix);`
  Build an adjacency matrix representation of the graph.
- `T getNil(ptr);, T getNil<T>();`
  Returning a "nil" value for graphs.
- `TSize inDegree(g, v);`
  Return in degree of a vertex.
- `TSize numEdges(g);`
  Returns the number of edges in a graph.
- `TSize numVertices(g);`
  Returns the number of vertices in a graph.
- `TSize outDegree(g, v);`
  Return out degree of a vertex.
- `void removeEdge(g, source, target[, label]);, void removeEdge(g, e);`
  Removes an edge from the graph. For automatons, a label is required.
- `void removeOutEdges(g, v);`
  Removes the incoming edges of a given vertex.
- `void removeOutEdges(g, v);`
  Removes the outgoing edges of a given vertex.
- `void removeVertex(g, v);`
  Remove a vertex from a Graph.
- `void resizeEdgeMap(pm, g[, prototype]);;`
  Initializes an edge map.
- `void resizeVertexMap(pm, g[, prototype]);`
  Initializes a vertex map.
- `TVertexDescriptor sourceVertex(g, e);, TVertexDescriptor sourceVertex(it);`
  Returns the source vertex of an edge.
- `TVertexDescriptor targetVertex(g, e);, TVertexDescriptor targetVertex(it);`
  Returns the target vertex of an edge.
- `void transpose(source, dest);, void transpose(g);`
  Transposes a graph, either in place or from source to dest.
- `void write(file, graph[, nodeMap[, edgeMap]], tag);`
  The graph to write out.

### Interface Functions Inherited From AssignableConcept

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

### Interface Functions Inherited From ContainerConcept

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

## Interface Metafunction Overview

- `Cargo<T>::Type;`
  Type for the graph's cargo.
- `EdgeDescriptor<T>::Type;`
  Type of an object that represents an edge descriptor.
- `EdgeIdHandler<T>::Type;`
  Type of an object that represents an IdManager.
- `EdgeType<T>::Type;`
  Edge type of a graph class.
- `Size<TGraph>::Type;`
  Size type of the Graph.
- `VertexIdHandler<T>::Type;`
  Type of an object that repreestns an IdManager.

### Interface Metafunctions Inherited From ContainerConcept

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

## Detailed Description

### Examples

This is an example for Dijktra's algorithm on a directed graph with an external property map. The property map labels the edges with weights. The xample only outputs distances, not th edetails of the paths.

    // A tutorial about the dijkstra's algorithm, once using an external map and once using an internal map.
    #include <iostream>
    #include <seqan/graph_algorithms.h>

    using namespace seqan;

    int main()
    {
        typedef Graph<Directed<> > TGraph;

        // Graph creation: 10 directed edges (0,1), (0,3), ...
        TGraph g;
        Size<TGraph>::Type numEdges = 10;
        VertexDescriptor<TGraph>::Type edges[] = {0, 1, 0, 3, 1, 2, 1, 3, 2, 4, 3, 1, 3, 2, 3, 4, 4, 0, 4, 2};
        addEdges(g, edges, numEdges);

        // One external property map: Weight map
        unsigned int weights[] =    {10, 5, 1, 2, 4, 3, 9, 2, 7, 6};
        String<unsigned int> weightMap;
        assignEdgeMap(weightMap, g, weights);

        // Out-parameters: Predecessor and distance map
        String<unsigned int> predMap;
        String<unsigned int> distMap;

        // Dijkstra from vertex 0 (single source shortest paths)
        dijkstra(predMap, distMap, g, 0, weightMap);

        // Output distances of shortest paths
        Iterator<TGraph, VertexIterator>::Type it(g);
        while (!atEnd(it))
        {
            std::cout << "Distance from 0 to " << getValue(it) << ": ";
            std::cout << getProperty(distMap, getValue(it)) << std::endl;
            goNext(it);
        }
        return 0;
    }

Demo: demos/dox/graph_types/graph_algo_dijkstra.cpp

The output of the distances is as follows:

    Distance from 0 to 0: 0
    Distance from 0 to 1: 8
    Distance from 0 to 2: 9
    Distance from 0 to 3: 5
    Distance from 0 to 4: 7

## Interface Functions Detail

### `TEdgeDescriptor addEdge(g, source, target, label[, cargo]); TEdgeDescriptor addEdge(g, source, target, cargo);`

Adds a new edge to a graph, either with or without cargo.

#### Parameters

`g` | The Graph to add the edge to.
`source` | Descriptor of the source vertex.
`source` | Descriptor of the target vertex.
`label` | Label of the edge, of alphabet type of the Automaton.
`cargo` | Cargo object for the edge.

#### Returns

`TEdgeDescriptor` | Descriptor of the added edge.

#### Remarks

For Automaton objects, a label is required but the label can only be given for Automatons.

#### Data Races

Thread safety unknown!

### `void addEdges(graph, edges, size);`

Shortcut to add multiple edges at once; vertices are created implicitely.

#### Parameters

`graph` | The Graph to add the edges to.
`edges` | An array of vertex descriptions.
`size` | Size of the array. Must be a even.

It is assumed that the edges in `edges` are stored as an array of vertex ids: `source1, target1, source2, target2, ...`. For a tree, the root must be the first vertex in this array and the enumeration is `parent, child, parent, child`.

#### Data Races

Thread safety unknown!

### `TVertexDescriptor addVertex(g);`

Add a vertex to a graph.

#### Parameters

`g` | The Graph to add a vertex to.

#### Returns

`TVertexDescriptor` | The descriptor of the added vertex.

#### Data Races

Thread safety unknown!

### `void assignEdgeMap(g, pm, prop);`

Initializes a vertex map with values of an array.

#### Parameters

`pm` | An property map.
`prop` | An array with properties that are to be assigned to the items in the property map.
`g` | A Graph.

For every edge id there must be an entry in the array.

#### Data Races

Thread safety unknown!

### `void assignVertexMap(g, pm, prop);`

Initializes a vertex map with values of an array.

#### Parameters

`pm` | A property map.
`g` | A Graph.
`prop` | An array with properties that are to be assigned to the items in the property map.

For every vertex descriptor there must be an entry in the array.

#### Data Races

Thread safety unknown!

### `void clear(g);`

Remove all edges and vertices from a graph.

#### Parameters

`g` | The graph to remove edges and vertices from.

#### Data Races

Thread safety unknown!

### `void clearEdges(g);`

Removes all edges from a graph.

#### Parameters

`g` | The graph to remove the edges from.

#### Data Races

Thread safety unknown!

### `void clearVertices(g);`

Removes all vertices from a graph.

#### Parameters

`g` | The graph to remove the vertices from.

#### Data Races

Thread safety unknown!

### `TSize degree(g, v);`

Return degree of a vertex.

#### Parameters

`g` | The Graph to query.
`v` | The descriptor of the vertex to query for its degree.

#### Returns

`TSize` | The number of edges adjacent to vertex v.

#### Data Races

Thread safety unknown!

### `bool empty(g);`

Returns whether there are no vertices and edges in the graph or not.

#### Parameters

`g` | The Graph to query.

#### Returns

`bool` | `true` if g is empty and `false` if not.

#### Data Races

Thread safety unknown!

### `TEdgeDescriptor findEdge(g, v, c); TEdgeDescriptor findEdge(g, v, w);`

Finds an edge.

#### Parameters

`g` | The Graph to query.
`v` | The descriptor of the source vertex.
`c` | An edge label.
`w` | The descriptor of the target descriptor.

#### Returns

`TEdgeDescriptor` | Edge descriptor of the found edge. 0 if not present. NB: in automatons, there is always a valid edge descriptor but the target may be nil.

#### Remarks

In an automaton, an edge is uniquely defined by a vertex and a label. In all other graphs, two adjacent vertices uniquely define an edge. If tehre are multiple edges between two vertices then the behaviour is undefined.

#### Data Races

Thread safety unknown!

### `void getAdjacencyMatrix(g, matrix);`

Build an adjacency matrix representation of the graph.

#### Parameters

`g` | The Graph to compute ajacency matrix for.
`matrix` | A String filled with `n * n` elements of IntegerConcept where `matrix[i + n * j]` gives the edge count between vertices `i` and `j`.

#### Data Races

Thread safety unknown!

### `T getNil(ptr); T getNil<T>();`

Returning a "nil" value for graphs.

#### Parameters

`ptr` | Pointer to T to select the type.

#### Returns

`T` | Pseudo nil value for type T.

Usefulf or various graph algorithms, e.g. missing predecessors or vertices that have not been visited.

#### Data Races

Thread safety unknown!

### `TSize inDegree(g, v);`

Return in degree of a vertex.

#### Parameters

`g` | The Graph to query.
`v` | The descriptor of the vertex to query for its in degree.

#### Returns

`TSize` | The number of in edges to vertex v.

#### Data Races

Thread safety unknown!

### `TSize numEdges(g);`

Returns the number of edges in a graph.

#### Parameters

`g` | The Graph to query for its number of edges.

#### Returns

`TSize` | The number of edges. TSize is the size type of g.

#### Data Races

Thread safety unknown!

### `TSize numVertices(g);`

Returns the number of vertices in a graph.

#### Parameters

`g` | The Graph to query for its number of vertices.

#### Returns

`TSize` | The number of vertices. TSize is the size type of g.

#### Data Races

Thread safety unknown!

### `TSize outDegree(g, v);`

Return out degree of a vertex.

#### Parameters

`g` | The Graph to query.
`v` | The descriptor of the vertex to query for its out degree.

#### Returns

`TSize` | The number of out edges from vertex v.

#### Data Races

Thread safety unknown!

### `void removeEdge(g, source, target[, label]); void removeEdge(g, e);`

Removes an edge from the graph. For automatons, a label is required.

#### Parameters

`g` | The Graph to remove the edge from.
`source` | Descriptor of the source vertex.
`target` | Descriptor of the target vertex.
`e` | Descriptor of the edge to remove.

#### Data Races

Thread safety unknown!

### `void removeOutEdges(g, v);`

Removes the incoming edges of a given vertex.

#### Parameters

`g` | The Graph to remove the edges from.
`v` | The descriptor of the vertex to remove incoming edges from.

#### Data Races

Thread safety unknown!

### `void removeOutEdges(g, v);`

Removes the outgoing edges of a given vertex.

#### Parameters

`g` | The Graph to remove the edges from.
`v` | The descriptor of the vertex to remove outgoing edges from.

#### Data Races

Thread safety unknown!

### `void removeVertex(g, v);`

Remove a vertex from a Graph.

#### Parameters

`g` | The Graph to remove the vertex from.
`v` | The descriptor of the vertex to remove.

#### Data Races

Thread safety unknown!

### `void resizeEdgeMap(pm, g[, prototype]);;`

Initializes an edge map.

#### Parameters

`pm` | A property map.
`g` | A Graph.
`prototype` | An optional prototype that is used for initializing the property map.

#### Data Races

Thread safety unknown!

### `void resizeVertexMap(pm, g[, prototype]);`

Initializes a vertex map.

#### Parameters

`pm` | A property map.
`g` | A Graph.
`prototype` | An optional prototype that is used for initializing the property map.

#### Data Races

Thread safety unknown!

### `TVertexDescriptor sourceVertex(g, e); TVertexDescriptor sourceVertex(it);`

Returns the source vertex of an edge.

#### Parameters

`g` | The Graph the edge is in.
`e` | The descriptor of the edge to remove.
`it` | An edge iterator.

#### Remarks

In a tree, the source vertex is always the child. In an undirected graph, the larger vertex descriptor of the two end points i the source. For an out-edge iterator, the source is always the OutEdgeIterator has been initialized with.

#### Data Races

Thread safety unknown!

### `TVertexDescriptor targetVertex(g, e); TVertexDescriptor targetVertex(it);`

Returns the target vertex of an edge.

#### Parameters

`g` | The Graph the edge is in.
`e` | The descriptor of the edge to remove.
`it` | An edge iterator.

#### Remarks

In a tree, the target vertex is always the child. In an undirected graph, the larger vertex descriptor of the two end points i the target. For an out-edge iterator, the target is always the OutEdgeIterator has not been initialized with.

#### Data Races

Thread safety unknown!

### `void transpose(source, dest); void transpose(g);`

Transposes a graph, either in place or from source to dest.

#### Parameters

`source` | The input Graph.
`dest` | The output Graph.
`g` | The Graph to transpose.

#### Data Races

Thread safety unknown!

### `void write(file, graph[, nodeMap[, edgeMap]], tag);`

The graph to write out.

#### Parameters

`file` | The StreamConcept to write to.
`graph` | The Graph to write out.
`nodeMap` | Vertex labels for each vertex; optional.
`edgeMap` | Edge label for each edge; optional.
`tag` | Format tag to use for writing. Types: DotDrawing.

#### Data Races

Thread safety unknown!

## Interface Metafunctions Detail

### `Cargo<T>::Type;`

Type for the graph's cargo.

#### Template Parameters

`T` | The Graph type to query.

#### Returns

`Type` | The resulting cargo type.

### `EdgeDescriptor<T>::Type;`

Type of an object that represents an edge descriptor.

#### Template Parameters

`T` | The Graph type to query.

#### Returns

`Type` | The resulting edge descriptor type.

The edge descriptor is a unique handle to a given edge in a graph. It is used in various graph functions, e.g. to remove edges, to assign cargo to an edge or to get the end points of an edge. It is also used to attache properties to edges via property maps.

#### Examples

    EdgeDescriptor<Graph<> >::Type ed;  // eD is an edge descriptor

### `EdgeIdHandler<T>::Type;`

Type of an object that represents an IdManager.

#### Template Parameters

`T` | The Graph to query.

#### Returns

`Type` | The IdManager type.

The exact IdManager type depends on the edge stump type. If the edge stump has no ids then the IdManager simply counts edge ids and otherwise it manages a list of free and used ids.

### `EdgeType<T>::Type;`

Edge type of a graph class.

#### Template Parameters

`T` | The Graph type to query.

#### Returns

`Type` | The resulting edge stump type that is used in the graph.

#### Examples

    EdgeType<TGraph>::Type e;  // e is an edge in a TGraph

### `Size<TGraph>::Type;`

Size type of the Graph.

#### Template Parameters

`TGraph` | The graph type to query for its size type.

#### Returns

`Type` | The size type.

### `VertexIdHandler<T>::Type;`

Type of an object that repreestns an IdManager.

#### Template Parameters

`T` | The Graph to query.

#### Returns

`Type` | The IdManager type.

#### Dox Sources

    /*!
     * @class Graph
     *
     * @implements ContainerConcept
     *
     * @headerfile <seqan/graph_types.h>
     *
     * @brief Graph class.
     *
     * @signature template <[typename TSpec]> class Graph;
     *
     * @tparam TSpec The specializing type. Default: Directed&lt;&gt;.
     *
     * @section Examples
     *
     * This is an example for Dijktra's algorithm on a directed graph with an
     * external property map. The property map labels the edges with weights. The
     * xample only outputs distances, not th edetails of the paths.
     *
     * @include demos/dox/graph_types/graph_algo_dijkstra.cpp
     *
     * The output of the distances is as follows:
     *
     * @include demos/dox/graph_types/graph_algo_dijkstra.cpp.stdout
     *
     *
     *
     * @mfn Graph#EdgeDescriptor
     *
     * @brief Type of an object that represents an edge descriptor.
     *
     * @signature EdgeDescriptor<T>::Type;
     *
     * @tparam T The @link Graph @endlink type to query.
     *
     * @return Type The resulting edge descriptor type.
     *
     * The edge descriptor is a unique handle to a given edge in a graph. It is used
     * in various graph functions, e.g. to remove edges, to assign cargo to an edge
     * or to get the end points of an edge. It is also used to attache properties to
     * edges via property maps.
     *
     * @section Examples
     *
     * @code{.cpp}
     * EdgeDescriptor<Graph<> >::Type ed;  // eD is an edge descriptor
     * @endcode
     *
     *
     * @mfn Graph#Cargo
     *
     * @brief Type for the graph's cargo.
     *
     * @signature Cargo<T>::Type;
     *
     * @tparam T The @link Graph @endlink type to query.
     *
     * @return Type The resulting cargo type.
     *
     * @mfn Graph#EdgeType
     *
     * @brief Edge type of a graph class.
     *
     * @signature EdgeType<T>::Type;
     *
     * @tparam T The @link Graph @endlink type to query.
     *
     * @return Type The resulting edge stump type that is used in the graph.
     *
     * @section Examples
     *
     * @code{.cpp}
     * EdgeType<TGraph>::Type e;  // e is an edge in a TGraph
     * @endcode
     *
     *
     * @mfn Graph#EdgeIdHandler
     *
     * @brief Type of an object that represents an IdManager.
     *
     * @signature EdgeIdHandler<T>::Type;
     *
     * @tparam T The Graph to query.
     *
     * @return Type The IdManager type.
     *
     * The exact IdManager type depends on the edge stump type. If the edge stump
     * has no ids then the IdManager simply counts edge ids and otherwise it manages
     * a list of free and used ids.
     *
     * @mfn Graph#VertexIdHandler
     *
     * @brief Type of an object that repreestns an IdManager.
     *
     * @signature VertexIdHandler<T>::Type;
     *
     * @tparam T The Graph to query.
     *
     * @return Type The IdManager type.
     *
     * @mfn Graph#Size
     *
     * @brief Size type of the Graph.
     *
     * @signature Size<TGraph>::Type;
     *
     * @tparam TGraph The graph type to query for its size type.
     *
     * @return Type The size type.
     *
     * @fn Graph#write
     *
     * @brief The graph to write out.
     *
     * @signature void write(file, graph[, nodeMap[, edgeMap]], tag);
     *
     * @param[in,out] file The @link StreamConcept @endlink to write to.
     * @param[in] graph The @link Graph @endlink to write out.
     * @param[in] nodeMap Vertex labels for each vertex; optional.
     * @param[in] edgeMap Edge label for each edge; optional.
     * @param[in] tag Format tag to use for writing. Types: DotDrawing.
     *
     * @fn Graph#transpose
     *
     * @brief Transposes a graph, either in place or from source to dest.
     *
     * @signature void transpose(source, dest);
     * @signature void transpose(g);
     *
     * @param[in] source The input @link Graph @endlink.
     * @param[in] dest The output @link Graph @endlink.
     * @param[in,out] g The @link Graph @endlink to transpose.
     *
     * @fn Graph#numEdges
     *
     * @brief Returns the number of edges in a graph.
     *
     * @signature TSize numEdges(g);
     *
     * @param[in] g The @link Graph @endlink to query for its number of edges.
     *
     * @return TSize The number of edges. TSize is the size type of g.
     *
     * @fn Graph#numVertices
     *
     * @brief Returns the number of vertices in a graph.
     *
     * @signature TSize numVertices(g);
     *
     * @param[in] g The @link Graph @endlink to query for its number of vertices.
     *
     * @return TSize The number of vertices. TSize is the size type of g.
     *
     * @fn Graph#empty
     *
     * @brief Returns whether there are no vertices and edges in the graph or not.
     *
     * @signature bool empty(g);
     *
     * @param[in] g The Graph to query.
     *
     * @return bool <tt>true</tt> if g is empty and <tt>false</tt> if not.
     *
     * @fn Graph#clearEdges
     *
     * @brief Removes all edges from a graph.
     *
     * @signature void clearEdges(g);
     *
     * @param[in,out] g The graph to remove the edges from.
     *
     * @fn Graph#clear
     *
     * @brief Remove all edges and vertices from a graph.
     *
     * @signature void clear(g);
     *
     * @param[in,out] g The graph to remove edges and vertices from.
     *
     * @fn Graph#outDegree
     *
     * @brief Return out degree of a vertex.
     *
     * @signature TSize outDegree(g, v);
     *
     * @param[in] g The Graph to query.
     * @param[in] v The descriptor of the vertex to query for its out degree.
     *
     * @return TSize The number of out edges from vertex v.
     *
     * @fn Graph#inDegree
     *
     * @brief Return in degree of a vertex.
     *
     * @signature TSize inDegree(g, v);
     *
     * @param[in] g The Graph to query.
     * @param[in] v The descriptor of the vertex to query for its in degree.
     *
     * @return TSize The number of in edges to vertex v.
     *
     * @fn Graph#degree
     *
     * @brief Return degree of a vertex.
     *
     * @signature TSize degree(g, v);
     *
     * @param[in] g The Graph to query.
     * @param[in] v The descriptor of the vertex to query for its degree.
     *
     * @return TSize The number of edges adjacent to vertex v.
     *
     * @fn Graph#addVertex
     *
     * @brief Add a vertex to a graph.
     *
     * @signature TVertexDescriptor addVertex(g);
     *
     * @param[in,out] g The Graph to add a vertex to.
     *
     * @return TVertexDescriptor The descriptor of the added vertex.
     *
     * @fn Graph#removeVertex
     *
     * @brief Remove a vertex from a Graph.
     *
     * @signature void removeVertex(g, v);
     *
     * @param[in,out] g The Graph to remove the vertex from.
     * @param[in] v The descriptor of the vertex to remove.
     *
     * @fn Graph#addEdge
     *
     * @brief Adds a new edge to a graph, either with or without cargo.
     *
     * @signature TEdgeDescriptor addEdge(g, source, target, label[, cargo]);
     * @signature TEdgeDescriptor addEdge(g, source, target, cargo);
     *
     * @param[in,out] g The Graph to add the edge to.
     * @param[in] source Descriptor of the source vertex.
     * @param[in] source Descriptor of the target vertex.
     * @param[in] label Label of the edge, of alphabet type of the Automaton.
     * @param[in] cargo Cargo object for the edge.
     *
     * @return TEdgeDescriptor Descriptor of the added edge.
     *
     * @section Remarks
     *
     * For Automaton objects, a label is required but the label can only be given
     * for Automatons.
     *
     * @fn Graph#removeEdge
     *
     * @brief Removes an edge from the graph. For automatons, a label is required.
     *
     * @signature void removeEdge(g, source, target[, label]);
     * @signature void removeEdge(g, e);
     *
     * @param[in,out] g The Graph to remove the edge from.
     * @param[in] source Descriptor of the source vertex.
     * @param[in] target Descriptor of the target vertex.
     * @param[in] e Descriptor of the edge to remove.
     *
     * @fn Graph#removeInEdges
     *
     * @brief Removes the incoming edges of a given vertex.
     *
     * @signature void removeOutEdges(g, v);
     *
     * @param[in] g The Graph to remove the edges from.
     * @param[in] v The descriptor of the vertex to remove incoming edges from.
     *
     * @fn Graph#removeOutEdges
     *
     * @brief Removes the outgoing edges of a given vertex.
     *
     * @signature void removeOutEdges(g, v);
     *
     * @param[in] g The Graph to remove the edges from.
     * @param[in] v The descriptor of the vertex to remove outgoing edges from.
     *
     * @fn Graph#targetVertex
     *
     * @brief Returns the target vertex of an edge.
     *
     * @signature TVertexDescriptor targetVertex(g, e);
     * @signature TVertexDescriptor targetVertex(it);
     *
     * @param[in] g The Graph the edge is in.
     * @param[in] e The descriptor of the edge to remove.
     * @param[in] it An edge iterator.
     *
     * @section Remarks
     *
     * In a tree, the target vertex is always the child. In an undirected graph, the
     * larger vertex descriptor of the two end points i the target. For an out-edge
     * iterator, the target is always the OutEdgeIterator has <b>not</b> been
     * initialized with.
     *
     * @fn Graph#sourceVertex
     *
     * @brief Returns the source vertex of an edge.
     *
     * @signature TVertexDescriptor sourceVertex(g, e);
     * @signature TVertexDescriptor sourceVertex(it);
     *
     * @param[in] g The Graph the edge is in.
     * @param[in] e The descriptor of the edge to remove.
     * @param[in] it An edge iterator.
     *
     * @section Remarks
     *
     * In a tree, the source vertex is always the child. In an undirected graph, the
     * larger vertex descriptor of the two end points i the source. For an out-edge
     * iterator, the source is always the OutEdgeIterator has been initialized with.
     *
     * @fn Graph#getAdjacencyMatrix
     *
     * @brief Build an adjacency matrix representation of the graph.
     *
     * @signature void getAdjacencyMatrix(g, matrix);
     *
     * @param[in] g The Graph to compute ajacency matrix for.
     * @param[out] matrix A @link String @endlink filled with <tt>n * n</tt>
     *                    elements of @link IntegerConcept @endlink where
     *                    <tt>matrix[i + n * j]</tt> gives the edge count between
     *                    vertices <tt>i</tt> and <tt>j</tt>.
     *
     * @fn Graph#findEdge
     *
     * @brief Finds an edge.
     *
     * @signature TEdgeDescriptor findEdge(g, v, c);
     * @signature TEdgeDescriptor findEdge(g, v, w);
     *
     * @param[in] g The Graph to query.
     * @param[in] v The descriptor of the source vertex.
     * @param[in] c An edge label.
     * @param[in] w The descriptor of the target descriptor.
     *
     * @return TEdgeDescriptor Edge descriptor of the found edge. 0 if not present.
     *                         NB: in automatons, there is always a valid edge
     *                         descriptor but the target may be nil.
     *
     * @section Remarks
     *
     * In an automaton, an edge is uniquely defined by a vertex and a label. In all
     * other graphs, two adjacent vertices uniquely define an edge. If tehre are
     * multiple edges between two vertices then the behaviour is undefined.
     *
     * @fn Graph#clearVertices
     *
     * @brief Removes all vertices from a graph.
     *
     * @signature void clearVertices(g);
     *
     * @param[in,out] g The graph to remove the vertices from.
     *
     * @fn Graph#getNil
     *
     * @brief Returning a "nil" value for graphs.
     *
     * @signature T getNil(ptr);
     * @signature T getNil<T>();
     *
     * @param[in] ptr Pointer to T to select the type.
     *
     * @return T Pseudo nil value for type T.
     *
     * Usefulf or various graph algorithms, e.g. missing predecessors or vertices
     * that have not been visited.
     *
     * @fn Graph#addEdges
     *
     * @brief Shortcut to add multiple edges at once; vertices are created
     *        implicitely.
     *
     * @signature void addEdges(graph, edges, size);
     *
     * @param[in,out] graph The Graph to add the edges to.
     * @param[in] edges An array of vertex descriptions.
     * @param[in] size Size of the array. Must be a even.
     *
     * It is assumed that the edges in <tt>edges</tt> are stored as an array of
     * vertex ids: <tt>source1, target1, source2, target2, ...</tt>. For a tree, the
     * root must be the first vertex in this array and the enumeration is
     * <tt>parent, child, parent, child</tt>.
     *
     * @fn Graph#resizeVertexMap
     *
     * @brief Initializes a vertex map.
     *
     * @signature void resizeVertexMap(pm, g[, prototype]);
     *
     * @param[in,out] pm A @link PropertyMapConcept property map @endlink.
     * @param[in] g A Graph.
     * @param[in] prototype An optional prototype that is used for initializing the
     *                      property map.
     *
     * @fn Graph#resizeEdgeMap
     *
     * @brief Initializes an edge map.
     *
     * @signature void resizeEdgeMap(pm, g[, prototype]);;
     *
     * @param[in,out] pm A @link PropertyMapConcept property map @endlink.
     * @param[in] g A Graph.
     * @param[in] prototype An optional prototype that is used for initializing the
     *                      property map.
     *
     * @fn Graph#assignVertexMap
     *
     * @brief Initializes a vertex map with values of an array.
     *
     * @signature void assignVertexMap(g, pm, prop);
     *
     * @param[out] pm A @link PropertyMapConcept property map @endlink.
     * @param[in] g A Graph.
     * @param[in] prop An array with properties that are to be assigned to the items
     *                 in the property map.
     *
     * For every vertex descriptor there must be an entry in the array.
     *
     * @fn Graph#assignEdgeMap
     *
     * @brief Initializes a vertex map with values of an array.
     *
     * @signature void assignEdgeMap(g, pm, prop);
     *
     * @param[in] pm An @link PropertyMapConcept property map @endlink.
     * @param[out] prop An array with properties that are to be assigned to the
     *                  items in the property map.
     * @param[in] g A Graph.
     *
     * For every edge id there must be an entry in the array.
     */