weaklyConnectedComponents - SeqAn API Documentation

# fn() weaklyConnectedComponents
Compute weakly connected components of a directed graph.

Defined in | <seqan/graph_algorithms.h>
Signature | `TSize weaklyConnectedComponents(components, g);`

## Parameters

`components` | A property map. Each vertex is mapped to a component id. If two vertices share the same id they are in the same component.
`g` | A DirectedGraph to use for the input.

## Return Values

`TSize` | The number of weakly connected components (Metafunction: Size of the type of `g`).

## Detailed Description

The running time is `O(n a(n, n))` where `a` is the inverse Ackermann function and thus almost linear. The union find data structure is used since the graph implementations do not allow the efficient iteration of in-edges.

## Data Races

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

#### Dox Sources

    /*!
     * @fn weaklyConnectedComponents
     *
     * @headerfile <seqan/graph_algorithms.h>
     *
     * @brief Compute weakly connected components of a directed graph.
     *
     * @signature TSize weaklyConnectedComponents(components, g);
     *
     * @param[out] components  A property map. Each vertex is mapped to a component
     *                        id. If two vertices share the same id they are in the
     *                        same component.
     * @param[in] g A @link DirectedGraph @endlink to use for the input.
     *
     * @return TSize The number of weakly connected components (Metafunction: @link
     *               Graph#Size @endlink of the type of <tt>g</tt>).
     *
     * The running time is <tt>O(n a(n, n))</tt> where <tt>a</tt> is the inverse
     * Ackermann function and thus almost linear. The union find data structure is
     * used since the graph implementations do not allow the efficient iteration of
     * in-edges.
     */