Adding GraphEdgeSet and GraphNodeSet classes to graph_utils.h.
authordeba
Fri, 04 Mar 2005 17:16:01 +0000
changeset 1192aa4483befa56
parent 1191 c988f12c6c0c
child 1193 c3585aec8cb3
Adding GraphEdgeSet and GraphNodeSet classes to graph_utils.h.
src/lemon/graph_utils.h
     1.1 --- a/src/lemon/graph_utils.h	Fri Mar 04 17:14:48 2005 +0000
     1.2 +++ b/src/lemon/graph_utils.h	Fri Mar 04 17:16:01 2005 +0000
     1.3 @@ -21,6 +21,7 @@
     1.4  
     1.5  #include <lemon/invalid.h>
     1.6  #include <lemon/utility.h>
     1.7 +#include <lemon/map_utils.h>
     1.8  
     1.9  ///\ingroup gutils
    1.10  ///\file
    1.11 @@ -261,8 +262,61 @@
    1.12       }
    1.13       
    1.14     };
    1.15 +  
    1.16 +  template <typename _Graph>
    1.17 +  class GraphNodeSet {
    1.18 +  public:
    1.19 +    
    1.20 +    typedef _Graph Graph;
    1.21  
    1.22 -/// @}
    1.23 +    typedef typename Graph::Node Item;
    1.24 +    typedef typename Graph::NodeIt ItemIt;
    1.25 +
    1.26 +    template <typename _Value>
    1.27 +    class Map : public Graph::template NodeMap<_Value> {
    1.28 +    public:
    1.29 +      typedef typename Graph::template NodeMap<_Value> Parent; 
    1.30 +      typedef typename Parent::Value Value;
    1.31 +
    1.32 +      Map(const Graph& _graph) : Parent(_graph) {}
    1.33 +      Map(const Graph& _graph, const Value& _value) 
    1.34 +	: Parent(_graph, _value) {}
    1.35 +    };
    1.36 +
    1.37 +    typedef IdMap<Graph, Item> IdMap;
    1.38 +    
    1.39 +  private:
    1.40 +    Graph* graph;
    1.41 +  };
    1.42 +
    1.43 +  template <typename _Graph>
    1.44 +  class GraphEdgeSet {
    1.45 +  public:
    1.46 +    
    1.47 +    typedef _Graph Graph;
    1.48 +
    1.49 +    typedef typename Graph::Edge Item;
    1.50 +    typedef typename Graph::EdgeIt ItemIt;
    1.51 +
    1.52 +    template <typename _Value>
    1.53 +    class Map : public Graph::template EdgeMap<_Value> {
    1.54 +    public:
    1.55 +      typedef typename Graph::template EdgeMap<_Value> Parent; 
    1.56 +      typedef typename Parent::Value Value;
    1.57 +
    1.58 +      Map(const Graph& _graph) : Parent(_graph) {}
    1.59 +      Map(const Graph& _graph, const Value& _value) 
    1.60 +	: Parent(_graph, _value) {}
    1.61 +    };
    1.62 +
    1.63 +    typedef IdMap<Graph, Item> IdMap;
    1.64 +    
    1.65 +  private:
    1.66 +    Graph* graph;
    1.67 +  };
    1.68 +
    1.69 +
    1.70 +  /// @}
    1.71    
    1.72  } //END OF NAMESPACE LEMON
    1.73