Loading...
Searching...
No Matches
SubDigraph< DGR, NF, AF > Class Template Reference
Data Structures » Graph Structures » Adaptor Classes for Graphs

## Detailed Description

template<typename DGR, typename NF, typename AF>
class lemon::SubDigraph< DGR, NF, AF >

SubDigraph can be used for hiding nodes and arcs in a digraph. A `bool` node map and a `bool` arc map must be specified, which define the filters for nodes and arcs. Only the nodes and arcs with `true` filter value are shown in the subdigraph. The arcs that are incident to hidden nodes are also filtered out. This adaptor conforms to the Digraph concept.

The adapted digraph can also be modified through this adaptor by adding or removing nodes or arcs, unless the `GR` template parameter is set to be `const`.

This class provides only linear time counting for nodes and arcs.

Template Parameters

  DGR | The type of the adapted digraph. It must conform to the Digraph concept. It can also be specified to be `const`.
  NF | The type of the node filter map. It must be a `bool` (or convertible) node map of the adapted digraph. The default type is DGR::NodeMap<bool>.
  AF | The type of the arc filter map. It must be `bool` (or convertible) arc map of the adapted digraph. The default type is DGR::ArcMap<bool>.

Note
  The `Node` and `Arc` types of this adaptor and the adapted digraph are convertible to each other.

See also
  FilterNodes
  FilterArcs

`#include <lemon/adaptors.h>`

## Public Types

typedef DGR | Digraph
| The type of the adapted digraph.
typedef NF | NodeFilterMap
| The type of the node filter map.
typedef AF | ArcFilterMap
| The type of the arc filter map.

## Public Member Functions

| SubDigraph (DGR &digraph, NF &node_filter, AF &arc_filter)
| Constructor.
void | status (const Node &n, bool v) const
| Sets the status of the given node.
void | status (const Arc &a, bool v) const
| Sets the status of the given arc.
bool | status (const Node &n) const
| Returns the status of the given node.
bool | status (const Arc &a) const
| Returns the status of the given arc.
void | disable (const Node &n) const
| Disables the given node.
void | disable (const Arc &a) const
| Disables the given arc.
void | enable (const Node &n) const
| Enables the given node.
void | enable (const Arc &a) const
| Enables the given arc.

## Related Symbols

(Note that these are not member symbols.)
template<typename DGR, typename NF, typename AF>
SubDigraph< const DGR, NF, AF > | subDigraph (const DGR &digraph, NF &node_filter, AF &arc_filter)
| Returns a read-only SubDigraph adaptor.

## Constructor & Destructor Documentation

## SubDigraph()

template<typename DGR, typename NF, typename AF>

SubDigraph | ( | DGR & | digraph,
|  | NF & | node_filter,
|  | AF & | arc_filter )

inline

Creates a subdigraph for the given digraph with the given node and arc filter maps.

## Member Function Documentation

## status() [1/4]

template<typename DGR, typename NF, typename AF>

void status | ( | const Node & | n,
|  | bool | v ) const

inline

This function sets the status of the given node. It is done by simply setting the assigned value of `n` to `v` in the node filter map.

## status() [2/4]

template<typename DGR, typename NF, typename AF>

void status | ( | const Arc & | a,
|  | bool | v ) const

inline

This function sets the status of the given arc. It is done by simply setting the assigned value of `a` to `v` in the arc filter map.

## status() [3/4]

template<typename DGR, typename NF, typename AF>

bool status | ( | const Node & | n | ) | const

inline

This function returns the status of the given node. It is `true` if the given node is enabled (i.e. not hidden).

## status() [4/4]

template<typename DGR, typename NF, typename AF>

bool status | ( | const Arc & | a | ) | const

inline

This function returns the status of the given arc. It is `true` if the given arc is enabled (i.e. not hidden).

## disable() [1/2]

template<typename DGR, typename NF, typename AF>

void disable | ( | const Node & | n | ) | const

inline

This function disables the given node in the subdigraph, so the iteration jumps over it. It is the same as status(n, false).

## disable() [2/2]

template<typename DGR, typename NF, typename AF>

void disable | ( | const Arc & | a | ) | const

inline

This function disables the given arc in the subdigraph, so the iteration jumps over it. It is the same as status(a, false).

## enable() [1/2]

template<typename DGR, typename NF, typename AF>

void enable | ( | const Node & | n | ) | const

inline

This function enables the given node in the subdigraph. It is the same as status(n, true).

## enable() [2/2]

template<typename DGR, typename NF, typename AF>

void enable | ( | const Arc & | a | ) | const

inline

This function enables the given arc in the subdigraph. It is the same as status(a, true).