src/lemon/graph_wrapper.h
changeset 932 ade3cdb9b45d
parent 930 e89f3bd26fd4
child 933 1b7c88fbb950
     1.1 --- a/src/lemon/graph_wrapper.h	Thu Sep 30 17:32:00 2004 +0000
     1.2 +++ b/src/lemon/graph_wrapper.h	Fri Oct 01 10:08:43 2004 +0000
     1.3 @@ -430,9 +430,8 @@
     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 -  typedef SubGraphWrapper<Graph, ConstMap<Node, bool>, TightEdgeFilter> SubGW;
     1.9 -  SubGW gw(g, const_true_map, tight_edge_filter);
    1.10 +  typedef EdgeSubGraphWrapper<Graph, TightEdgeFilter> SubGW;
    1.11 +  SubGW gw(g, tight_edge_filter);
    1.12    \endcode
    1.13    Then, the maximum nimber of edge-disjoint \c s-\c t paths are computed 
    1.14    with a max flow algorithm Preflow.
    1.15 @@ -671,6 +670,34 @@
    1.16    };
    1.17  
    1.18  
    1.19 +  /*! \brief A wrapper for hiding edges from a graph.
    1.20 +
    1.21 +  \warning Graph wrappers are in even more experimental state than the other
    1.22 +  parts of the lib. Use them at you own risk.
    1.23 +  
    1.24 +  A wrapper for hiding edges from a graph.
    1.25 +  This wrapper specializes SubGraphWrapper in the way that only the edge-set 
    1.26 +  can be filtered.
    1.27 +  \author Marton Makai
    1.28 +  */
    1.29 +  template<typename Graph, typename EdgeFilterMap>
    1.30 +  class EdgeSubGraphWrapper : 
    1.31 +    public SubGraphWrapper<Graph, ConstMap<typename Graph::Node,bool>, 
    1.32 +			   EdgeFilterMap> {
    1.33 +  public:
    1.34 +    typedef SubGraphWrapper<Graph, ConstMap<typename Graph::Node,bool>, 
    1.35 +			    EdgeFilterMap> Parent;
    1.36 +  protected:
    1.37 +    ConstMap<typename Graph::Node, bool> const_true_map;
    1.38 +  public:
    1.39 +    EdgeSubGraphWrapper(Graph& _graph, EdgeFilterMap& _edge_filter_map) : 
    1.40 +      Parent(), const_true_map(true) { 
    1.41 +      Parent::setGraph(_graph);
    1.42 +      Parent::setNodeFilterMap(const_true_map);
    1.43 +      Parent::setEdgeFilterMap(_edge_filter_map);
    1.44 +    }
    1.45 +  };
    1.46 +
    1.47  
    1.48    template<typename Graph>
    1.49    class UndirGraphWrapper : public GraphWrapper<Graph> {