All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
List of all members | Public Member Functions | Related Functions
FilterNodes< GR, NF > Class Template Reference

Detailed Description

template<typename GR, typename NF>
class lemon::FilterNodes< GR, NF >

FilterNodes adaptor can be used for hiding nodes in a digraph or a graph. A bool node map must be specified, which defines the filter for the nodes. Only the nodes with true filter value and the arcs/edges incident to nodes both with true filter value are shown in the subgraph. This adaptor conforms to the Digraph concept or the Graph concept depending on the GR template parameter.

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

This class provides only linear time item counting.

Template Parameters
GRThe type of the adapted digraph or graph. It must conform to the Digraph concept or the Graph concept. It can also be specified to be const.
NFThe type of the node filter map. It must be a bool (or convertible) node map of the adapted (di)graph. The default type is GR::NodeMap<bool>.
Note
The Node and Arc/Edge types of this adaptor and the adapted (di)graph are convertible to each other.

#include <lemon/adaptors.h>

Public Member Functions

 FilterNodes (GR &graph, NF &node_filter)
 Constructor.
 
void status (const Node &n, bool v) const
 Sets the status of the given node.
 
bool status (const Node &n) const
 Returns the status of the given node.
 
void disable (const Node &n) const
 Disables the given node.
 
void enable (const Node &n) const
 Enables the given node.
 

Related Functions

(Note that these are not member functions.)

template<typename GR , typename NF >
FilterNodes< const GR, NF > filterNodes (const GR &graph, NF &node_filter)
 Returns a read-only FilterNodes adaptor.
 

Constructor & Destructor Documentation

FilterNodes ( GR &  graph,
NF &  node_filter 
)
inline

Creates a subgraph for the given digraph or graph with the given node filter map.

Member Function Documentation

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.

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).

void disable ( const Node &  n) const
inline

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

void enable ( const Node &  n) const
inline

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