1.1 --- a/src/lemon/graph_wrapper.h Tue Mar 22 12:02:29 2005 +0000
1.2 +++ b/src/lemon/graph_wrapper.h Tue Mar 22 16:00:00 2005 +0000
1.3 @@ -41,10 +41,10 @@
1.4
1.5 /*!
1.6 Base type for the Graph Wrappers
1.7 -
1.8 +
1.9 \warning Graph wrappers are in even more experimental state than the other
1.10 parts of the lib. Use them at you own risk.
1.11 -
1.12 +
1.13 This is the base type for most of LEMON graph wrappers.
1.14 This class implements a trivial graph wrapper i.e. it only wraps the
1.15 functions and types of the graph. The purpose of this class is to
1.16 @@ -314,20 +314,30 @@
1.17 };
1.18
1.19 /*! \brief A graph wrapper for hiding nodes and edges from a graph.
1.20 -
1.21 +
1.22 \warning Graph wrappers are in even more experimental state than the other
1.23 parts of the lib. Use them at you own risk.
1.24
1.25 - This wrapper shows a graph with filtered node-set and
1.26 + SubGraphWrapper shows the graph with filtered node-set and
1.27 edge-set.
1.28 - Given a bool-valued map on the node-set and one on
1.29 - the edge-set of the graph, the iterators show only the objects
1.30 - having true value. We have to note that this does not mean that an
1.31 + Let \f$G=(V, A)\f$ be a directed graph
1.32 + and suppose that the graph instance \c g of type ListGraph implements
1.33 + \f$G\f$.
1.34 + Let moreover \f$b_V\f$ and
1.35 + \f$b_A\f$ be bool-valued functions resp. on the node-set and edge-set.
1.36 + SubGraphWrapper<...>::NodeIt iterates
1.37 + on the node-set \f$\{v\in V : b_V(v)=true\}\f$ and
1.38 + SubGraphWrapper<...>::EdgeIt iterates
1.39 + on the edge-set \f$\{e\in A : b_A(e)=true\}\f$. Similarly,
1.40 + SubGraphWrapper<...>::OutEdgeIt and SubGraphWrapper<...>::InEdgeIt iterates
1.41 + only on edges leaving and entering a specific node which have true value.
1.42 +
1.43 + We have to note that this does not mean that an
1.44 induced subgraph is obtained, the node-iterator cares only the filter
1.45 on the node-set, and the edge-iterators care only the filter on the
1.46 - edge-set.
1.47 + edge-set.
1.48 \code
1.49 - typedef SmartGraph Graph;
1.50 + typedef ListGraph Graph;
1.51 Graph g;
1.52 typedef Graph::Node Node;
1.53 typedef Graph::Edge Edge;
1.54 @@ -1019,12 +1029,38 @@
1.55 };
1.56
1.57
1.58 - /// A wrapper for composing the residual graph for directed flow and circulation problems.
1.59 + /*! \brief A wrapper for composing the residual graph for directed flow and circulation problems.
1.60
1.61 - ///\warning Graph wrappers are in even more experimental state than the other
1.62 - ///parts of the lib. Use them at you own risk.
1.63 - ///
1.64 - /// A wrapper for composing the residual graph for directed flow and circulation problems.
1.65 + A wrapper for composing the residual graph for directed flow and circulation problems.
1.66 + Let \f$G=(V, A)\f$ be a directed graph and let \f$F\f$ be a
1.67 + number type. Let moreover
1.68 + \f$f,c:A\to F\f$, be functions on the edge-set.
1.69 + In the appications of ResGraphWrapper, \f$f\f$ usually stands for a flow
1.70 + and \f$c\f$ for a capacity function.
1.71 + Suppose that a graph instange \c g of type
1.72 + \c ListGraph implements \f$G\f$.
1.73 + \code
1.74 + ListGraph g;
1.75 + \endcode
1.76 + Then RevGraphWrapper implements the graph structure with node-set
1.77 + \f$V\f$ and edge-set \f$A_{forward}\cup A_{backward}\f$, where
1.78 + \f$A_{forward}=\{uv : uv\in A, f(uv)<c(uv)\}\f$ and
1.79 + \f$A_{backward}=\{vu : uv\in A, f(uv)>0\}\f$,
1.80 + i.e. the so called residual graph.
1.81 + When we take the union \f$A_{forward}\cup A_{backward}\f$,
1.82 + multilicities are counted, i.e. if an edge is in both
1.83 + \f$A_{forward}\f$ and \f$A_{backward}\f$, then in the wrapper it
1.84 + appears twice.
1.85 + The following code shows how
1.86 + such an instance can be constructed.
1.87 + \code
1.88 + typedef ListGraph Graph;
1.89 + Graph::EdgeMap<int> f(g);
1.90 + Graph::EdgeMap<int> c(g);
1.91 + ResGraphWrapper<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > gw(g);
1.92 + \endcode
1.93 + \author Marton Makai
1.94 + */
1.95 template<typename Graph, typename Number,
1.96 typename CapacityMap, typename FlowMap>
1.97 class ResGraphWrapper :