[Lemon-commits] [lemon_svn] marci: r1255 - in hugo/trunk/src: demo lemon
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:44:12 CET 2006
Author: marci
Date: Fri Oct 1 12:08:43 2004
New Revision: 1255
Modified:
hugo/trunk/src/demo/sub_graph_wrapper_demo.cc
hugo/trunk/src/lemon/graph_wrapper.h
Log:
New EdgeSubGraphWrapper class specializing SubGraphWrapper in the way that only the edge-set can be filtered.
Modified: hugo/trunk/src/demo/sub_graph_wrapper_demo.cc
==============================================================================
--- hugo/trunk/src/demo/sub_graph_wrapper_demo.cc (original)
+++ hugo/trunk/src/demo/sub_graph_wrapper_demo.cc Fri Oct 1 12:08:43 2004
@@ -55,10 +55,11 @@
TightEdgeFilter;
TightEdgeFilter tight_edge_filter(g, dijkstra.distMap(), length);
- ConstMap<Node, bool> const_true_map(true);
+// ConstMap<Node, bool> const_true_map(true);
// This graph contains exaclty the tight edges.
- typedef SubGraphWrapper<Graph, ConstMap<Node, bool>, TightEdgeFilter> SubGW;
- SubGW gw(g, const_true_map, tight_edge_filter);
+// typedef SubGraphWrapper<Graph, ConstMap<Node, bool>, TightEdgeFilter> SubGW;
+ typedef EdgeSubGraphWrapper<Graph, TightEdgeFilter> SubGW;
+ SubGW gw(g, tight_edge_filter);
ConstMap<Edge, int> const_1_map(1);
Graph::EdgeMap<int> flow(g, 0);
Modified: hugo/trunk/src/lemon/graph_wrapper.h
==============================================================================
--- hugo/trunk/src/lemon/graph_wrapper.h (original)
+++ hugo/trunk/src/lemon/graph_wrapper.h Fri Oct 1 12:08:43 2004
@@ -430,9 +430,8 @@
TightEdgeFilter;
TightEdgeFilter tight_edge_filter(g, dijkstra.distMap(), length);
- ConstMap<Node, bool> const_true_map(true);
- typedef SubGraphWrapper<Graph, ConstMap<Node, bool>, TightEdgeFilter> SubGW;
- SubGW gw(g, const_true_map, tight_edge_filter);
+ typedef EdgeSubGraphWrapper<Graph, TightEdgeFilter> SubGW;
+ SubGW gw(g, tight_edge_filter);
\endcode
Then, the maximum nimber of edge-disjoint \c s-\c t paths are computed
with a max flow algorithm Preflow.
@@ -671,6 +670,34 @@
};
+ /*! \brief A wrapper for hiding edges from a graph.
+
+ \warning Graph wrappers are in even more experimental state than the other
+ parts of the lib. Use them at you own risk.
+
+ A wrapper for hiding edges from a graph.
+ This wrapper specializes SubGraphWrapper in the way that only the edge-set
+ can be filtered.
+ \author Marton Makai
+ */
+ template<typename Graph, typename EdgeFilterMap>
+ class EdgeSubGraphWrapper :
+ public SubGraphWrapper<Graph, ConstMap<typename Graph::Node,bool>,
+ EdgeFilterMap> {
+ public:
+ typedef SubGraphWrapper<Graph, ConstMap<typename Graph::Node,bool>,
+ EdgeFilterMap> Parent;
+ protected:
+ ConstMap<typename Graph::Node, bool> const_true_map;
+ public:
+ EdgeSubGraphWrapper(Graph& _graph, EdgeFilterMap& _edge_filter_map) :
+ Parent(), const_true_map(true) {
+ Parent::setGraph(_graph);
+ Parent::setNodeFilterMap(const_true_map);
+ Parent::setEdgeFilterMap(_edge_filter_map);
+ }
+ };
+
template<typename Graph>
class UndirGraphWrapper : public GraphWrapper<Graph> {
More information about the Lemon-commits
mailing list