Loading...
Searching...
No Matches
SubGraph< GR, NF, EF > Class Template Reference
Data Structures » Graph Structures » Adaptor Classes for Graphs

## Detailed Description

template<typename GR, typename NF, typename EF>
class lemon::SubGraph< GR, NF, EF >

SubGraph can be used for hiding nodes and edges in a graph. A `bool` node map and a `bool` edge map must be specified, which define the filters for nodes and edges. Only the nodes and edges with `true` filter value are shown in the subgraph. The edges that are incident to hidden nodes are also filtered out. This adaptor conforms to the Graph concept.

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

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

Template Parameters

  GR | The type of the adapted graph. It must conform to the Graph 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 graph. The default type is GR::NodeMap<bool>.
  EF | The type of the edge filter map. It must be a `bool` (or convertible) edge map of the adapted graph. The default type is GR::EdgeMap<bool>.

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

See also
  FilterNodes
  FilterEdges

`#include <lemon/adaptors.h>`

## Public Types

typedef GR | Graph
| The type of the adapted graph.
typedef NF | NodeFilterMap
| The type of the node filter map.
typedef EF | EdgeFilterMap
| The type of the edge filter map.

## Public Member Functions

| SubGraph (GR &graph, NF &node_filter, EF &edge_filter)
| Constructor.
void | status (const Node &n, bool v) const
| Sets the status of the given node.
void | status (const Edge &e, bool v) const
| Sets the status of the given edge.
bool | status (const Node &n) const
| Returns the status of the given node.
bool | status (const Edge &e) const
| Returns the status of the given edge.
void | disable (const Node &n) const
| Disables the given node.
void | disable (const Edge &e) const
| Disables the given edge.
void | enable (const Node &n) const
| Enables the given node.
void | enable (const Edge &e) const
| Enables the given edge.

## Related Symbols

(Note that these are not member symbols.)
template<typename GR, typename NF, typename EF>
SubGraph< const GR, NF, EF > | subGraph (const GR &graph, NF &node_filter, EF &edge_filter)
| Returns a read-only SubGraph adaptor.

## Constructor & Destructor Documentation

## SubGraph()

template<typename GR, typename NF, typename EF>

SubGraph | ( | GR & | graph,
|  | NF & | node_filter,
|  | EF & | edge_filter )

inline

Creates a subgraph for the given graph with the given node and edge filter maps.

## Member Function Documentation

## status() [1/4]

template<typename GR, typename NF, typename EF>

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 GR, typename NF, typename EF>

void status | ( | const Edge & | e,
|  | bool | v ) const

inline

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

## status() [3/4]

template<typename GR, typename NF, typename EF>

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 GR, typename NF, typename EF>

bool status | ( | const Edge & | e | ) | const

inline

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

## disable() [1/2]

template<typename GR, typename NF, typename EF>

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 GR, typename NF, typename EF>

void disable | ( | const Edge & | e | ) | const

inline

This function disables the given edge in the subgraph, so the iteration jumps over it. It is the same as status(e, false).

## enable() [1/2]

template<typename GR, typename NF, typename EF>

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 GR, typename NF, typename EF>

void enable | ( | const Edge & | e | ) | const

inline

This function enables the given edge in the subgraph. It is the same as status(e, true).