SubGraphWrapper Class Template Reference
[Wrapper Classes for Graphs]

#include <graph_wrapper.h>

Inheritance diagram for SubGraphWrapper:

Inheritance graph
[legend]
Collaboration diagram for SubGraphWrapper:

Collaboration graph
[legend]
List of all members.

Detailed Description

template<typename Graph, typename NodeFilterMap, typename EdgeFilterMap>
class lemon::SubGraphWrapper< Graph, NodeFilterMap, EdgeFilterMap >

Warning:
Graph wrappers are in even more experimental state than the other parts of the lib. Use them at you own risk.
This wrapper shows a graph with filtered node-set and edge-set. Given a bool-valued map on the node-set and one on the edge-set of the graph, the iterators show only the objects having true value. We have to note that this does not mean that an induced subgraph is obtained, the node-iterator cares only the filter on the node-set, and the edge-iterators care only the filter on the edge-set.
      typedef SmartGraph Graph;
      Graph g;
      typedef Graph::Node Node;
      typedef Graph::Edge Edge;
      Node u=g.addNode(); //node of id 0
      Node v=g.addNode(); //node of id 1
      Node e=g.addEdge(u, v); //edge of id 0
      Node f=g.addEdge(v, u); //edge of id 1
      Graph::NodeMap<bool> nm(g, true);
      nm.set(u, false);
      Graph::EdgeMap<bool> em(g, true);
      em.set(e, false);
      typedef SubGraphWrapper<Graph, Graph::NodeMap<bool>, Graph::EdgeMap<bool> > SubGW;
      SubGW gw(g, nm, em);
      for (SubGW::NodeIt n(gw); n!=INVALID; ++n) std::cout << g.id(n) << std::endl;
      std::cout << ":-)" << std::endl;
      for (SubGW::EdgeIt e(gw); e!=INVALID; ++e) std::cout << g.id(e) << std::endl;
The output of the above code is the following.
      1
      :-)
      1
Note that n is of type SubGW::NodeIt, but it can be converted to Graph::Node that is why g.id(n) can be applied.

Author:
Marton Makai

Definition at line 370 of file graph_wrapper.h.

Public Member Functions

void hide (const Node &n) const
void hide (const Edge &e) const
void unHide (const Node &n) const
void unHide (const Edge &e) const
bool hidden (const Node &n) const
 Returns true if n is hidden.
bool hidden (const Edge &e) const
 Returns true if n is hidden.
int nodeNum () const
int edgeNum () const


Member Function Documentation

void hide const Node &  n  )  const [inline]
 

This function hides n in the graph, i.e. the iteration jumps over it. This is done by simply setting the value of n to be false in the corresponding node-map. Definition at line 516 of file graph_wrapper.h.

void hide const Edge &  e  )  const [inline]
 

This function hides e in the graph, i.e. the iteration jumps over it. This is done by simply setting the value of e to be false in the corresponding edge-map. Definition at line 521 of file graph_wrapper.h.

void unHide const Node &  n  )  const [inline]
 

The value of n is set to be true in the node-map which stores hide information. If n was hidden previuosly, then it is shown again Definition at line 526 of file graph_wrapper.h.

void unHide const Edge &  e  )  const [inline]
 

The value of e is set to be true in the edge-map which stores hide information. If e was hidden previuosly, then it is shown again Definition at line 531 of file graph_wrapper.h.

int nodeNum  )  const [inline]
 

Warning:
This is a linear time operation and works only if Graph::NodeIt is defined.

Reimplemented from GraphWrapper.

Definition at line 541 of file graph_wrapper.h.

int edgeNum  )  const [inline]
 

Warning:
This is a linear time operation and works only if Graph::EdgeIt is defined.

Reimplemented from GraphWrapper.

Definition at line 549 of file graph_wrapper.h.


The documentation for this class was generated from the following file:
Generated on Thu Sep 30 12:18:37 2004 for LEMON by doxygen 1.3.8