Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

SubGraphWrapper Class Template Reference
[Wrapper Classes for Graphs]

#include <lemon/graph_wrapper.h>

Inheritance diagram for SubGraphWrapper:

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

For other examples see also the documentation of NodeSubGraphWrapper and EdgeSubGraphWrapper.

Author:
Marton Makai

Definition at line 416 of file graph_wrapper.h.


The documentation for this class was generated from the following file:
Generated on Mon Feb 21 15:02:32 2005 for LEMON by  doxygen 1.4.1