FilterEdges adaptor can be used for hiding edges in a graph. A bool
edge map must be specified, which defines the filter for the edges. Only the edges with true
filter value are shown in the subgraph. 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.
GR | The type of the adapted graph. It must conform to the Graph concept. It can also be specified to be const . |
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>. |
Node
, Edge
and Arc
types of this adaptor and the adapted graph are convertible to each other. #include <lemon/adaptors.h>
Public Types | |
typedef GR | Graph |
The type of the adapted graph. | |
typedef EF | EdgeFilterMap |
The type of the edge filter map. | |
Public Member Functions | |
FilterEdges (GR &graph, EF &edge_filter) | |
Constructor. | |
void | status (const Edge &e, bool v) const |
Sets the status of the given edge. | |
bool | status (const Edge &e) const |
Returns the status of the given edge. | |
void | disable (const Edge &e) const |
Disables the given edge. | |
void | enable (const Edge &e) const |
Enables the given edge. | |
Related Functions | |
(Note that these are not member functions.) | |
template<typename GR , typename EF > | |
FilterEdges< const GR, EF > | filterEdges (const GR &graph, EF &edge_filter) |
Returns a read-only FilterEdges adaptor. |
FilterEdges | ( | GR & | graph, |
EF & | edge_filter | ||
) | [inline] |
Creates a subgraph for the given graph with the given edge filter map.
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.
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).
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).
void enable | ( | const Edge & | e | ) | const [inline] |
This function enables the given edge in the subgraph. It is the same as status(e, true).