New EdgeSubGraphWrapper class specializing SubGraphWrapper in the way that only the edge-set can be filtered.
1.1 --- a/src/demo/sub_graph_wrapper_demo.cc Thu Sep 30 17:32:00 2004 +0000
1.2 +++ b/src/demo/sub_graph_wrapper_demo.cc Fri Oct 01 10:08:43 2004 +0000
1.3 @@ -55,10 +55,11 @@
1.4 TightEdgeFilter;
1.5 TightEdgeFilter tight_edge_filter(g, dijkstra.distMap(), length);
1.6
1.7 - ConstMap<Node, bool> const_true_map(true);
1.8 +// ConstMap<Node, bool> const_true_map(true);
1.9 // This graph contains exaclty the tight edges.
1.10 - typedef SubGraphWrapper<Graph, ConstMap<Node, bool>, TightEdgeFilter> SubGW;
1.11 - SubGW gw(g, const_true_map, tight_edge_filter);
1.12 +// typedef SubGraphWrapper<Graph, ConstMap<Node, bool>, TightEdgeFilter> SubGW;
1.13 + typedef EdgeSubGraphWrapper<Graph, TightEdgeFilter> SubGW;
1.14 + SubGW gw(g, tight_edge_filter);
1.15
1.16 ConstMap<Edge, int> const_1_map(1);
1.17 Graph::EdgeMap<int> flow(g, 0);
2.1 --- a/src/lemon/graph_wrapper.h Thu Sep 30 17:32:00 2004 +0000
2.2 +++ b/src/lemon/graph_wrapper.h Fri Oct 01 10:08:43 2004 +0000
2.3 @@ -430,9 +430,8 @@
2.4 TightEdgeFilter;
2.5 TightEdgeFilter tight_edge_filter(g, dijkstra.distMap(), length);
2.6
2.7 - ConstMap<Node, bool> const_true_map(true);
2.8 - typedef SubGraphWrapper<Graph, ConstMap<Node, bool>, TightEdgeFilter> SubGW;
2.9 - SubGW gw(g, const_true_map, tight_edge_filter);
2.10 + typedef EdgeSubGraphWrapper<Graph, TightEdgeFilter> SubGW;
2.11 + SubGW gw(g, tight_edge_filter);
2.12 \endcode
2.13 Then, the maximum nimber of edge-disjoint \c s-\c t paths are computed
2.14 with a max flow algorithm Preflow.
2.15 @@ -671,6 +670,34 @@
2.16 };
2.17
2.18
2.19 + /*! \brief A wrapper for hiding edges from a graph.
2.20 +
2.21 + \warning Graph wrappers are in even more experimental state than the other
2.22 + parts of the lib. Use them at you own risk.
2.23 +
2.24 + A wrapper for hiding edges from a graph.
2.25 + This wrapper specializes SubGraphWrapper in the way that only the edge-set
2.26 + can be filtered.
2.27 + \author Marton Makai
2.28 + */
2.29 + template<typename Graph, typename EdgeFilterMap>
2.30 + class EdgeSubGraphWrapper :
2.31 + public SubGraphWrapper<Graph, ConstMap<typename Graph::Node,bool>,
2.32 + EdgeFilterMap> {
2.33 + public:
2.34 + typedef SubGraphWrapper<Graph, ConstMap<typename Graph::Node,bool>,
2.35 + EdgeFilterMap> Parent;
2.36 + protected:
2.37 + ConstMap<typename Graph::Node, bool> const_true_map;
2.38 + public:
2.39 + EdgeSubGraphWrapper(Graph& _graph, EdgeFilterMap& _edge_filter_map) :
2.40 + Parent(), const_true_map(true) {
2.41 + Parent::setGraph(_graph);
2.42 + Parent::setNodeFilterMap(const_true_map);
2.43 + Parent::setEdgeFilterMap(_edge_filter_map);
2.44 + }
2.45 + };
2.46 +
2.47
2.48 template<typename Graph>
2.49 class UndirGraphWrapper : public GraphWrapper<Graph> {