Home | Documentation | Download | Platforms | Projects | Mailing Lists | Version History

- Main Page
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# components Class Reference

Connected components algorithm. More...

Inheritance diagram for components:

[legend]
Collaboration diagram for components:

[legend]

List of all members.

## Public Member Functions

| components ()
| Creates connected components algorithm object.
virtual | ~components ()
| Destroys connected components algorithm object.
virtual int | check (graph &G)
| Checks whether the connected components algorithm can be applied.
virtual void | reset ()
| Resets algorithm.
component_iterator | components_begin ()
| Start iteration over all components (if enabled during last call to run).
component_iterator | components_end ()
| End of iteration over all components.
int | number_of_components () const
| Number of components detected during the last run.
virtual void | before_recursive_call_handler (graph &, edge &, node &)
| Handler called when a unused node n connected to the actual node by e is found.
virtual void | old_adj_node_handler (graph &, edge &, node &)
| Handler called when a already marked node n connected to the actual node by e is found during the search of all adjacent edges of the actual node.
virtual void | new_start_handler (graph &, node &)
| Called when DFS is started with start-node n.

## Detailed Description

Connected components algorithm.

## Constructor & Destructor Documentation

components::components | ( |  | ) |

Creates connected components algorithm object.

See also:
  dfs::dfs

virtual components::~components | ( |  | ) | `[inline, virtual]`

Destroys connected components algorithm object.

See also:
  dfs::~dfs

## Member Function Documentation

virtual int components::check | ( | graph & | G | ) | `[virtual]`

Checks whether the connected components algorithm can be applied.

Necessary preconditions:

- G is undirected.
- scanning of whole graph is enabled.
- DFS may be applied

Parameters:

  | G | graph.

Returns:
  algorithm::GTL_OK if connected components can be computed for G.

See also:
  dfs::scan_whole_graph

Reimplemented from dfs.

virtual void components::reset | ( |  | ) | `[virtual]`

Resets algorithm.

Prepares the algorithm to be applied to another graph. Please note: The options an algorithm may support do not get reset by this. It is just to reset internally used datastructures.

Reimplemented from dfs.

component_iterator components::components_begin | ( |  | ) | `[inline]`

Start iteration over all components (if enabled during last call to run).

Components are represented as a pair consisting of a list of nodes and a list of edges, i.e. if `it` is of type `component_iterator` then `*it` is of type `pair<list<node>`,list<edge> >.

Returns:
  iterator to first component

component_iterator components::components_end | ( |  | ) | `[inline]`

End of iteration over all components.

Returns:
  end of iteration over biconnected components

See also:
  biconnectivity::store_components

int components::number_of_components | ( |  | ) | const`[inline]`

Number of components detected during the last run.

Returns:
  number of components.

virtual void components::before_recursive_call_handler | ( | graph & | G,
|  | edge & | e,
|  | node & | n |
| ) |  |  | `[virtual]`

Handler called when a unused node n connected to the actual node by e is found.

Parameters:

  | G | graph for which DFS was invoked.
  | e | edge connecting the actual node to the unused one.
  | n | unused node.

Reimplemented from dfs.

virtual void components::old_adj_node_handler | ( | graph & | G,
|  | edge & | e,
|  | node & | n |
| ) |  |  | `[virtual]`

Handler called when a already marked node n connected to the actual node by e is found during the search of all adjacent edges of the actual node.

Parameters:

  | G | graph for which DFS was invoked.
  | e | edge connecting the actual node to the old one.
  | n | used node.

Reimplemented from dfs.

virtual void components::new_start_handler | ( | graph & | G,
|  | node & | n |
| ) |  |  | `[virtual]`

Called when DFS is started with start-node n.

This is particularly useful when DFS was invoked with the scan_whole_graph option.

Parameters:

  | G | graph for which DFS was invoked.
  | n | start-node.

Reimplemented from dfs.

University of Passau - FMI - Theoretical Computer Science

Design © 2002, 2003 Marcus Raitner, University of Passau