lemon/dfs.h
changeset 1709 a323456bf7c8
parent 1694 6d81e6f7a88d
child 1710 f531c16dd923
     1.1 --- a/lemon/dfs.h	Wed Oct 05 13:44:29 2005 +0000
     1.2 +++ b/lemon/dfs.h	Wed Oct 05 16:45:37 2005 +0000
     1.3 @@ -57,23 +57,6 @@
     1.4      {
     1.5        return new PredMap(G);
     1.6      }
     1.7 -//     ///\brief The type of the map that stores the last but one
     1.8 -//     ///nodes of the %DFS paths.
     1.9 -//     ///
    1.10 -//     ///The type of the map that stores the last but one
    1.11 -//     ///nodes of the %DFS paths.
    1.12 -//     ///It must meet the \ref concept::WriteMap "WriteMap" concept.
    1.13 -//     ///
    1.14 -//     typedef NullMap<typename Graph::Node,typename Graph::Node> PredNodeMap;
    1.15 -//     ///Instantiates a PredNodeMap.
    1.16 -    
    1.17 -//     ///This function instantiates a \ref PredNodeMap. 
    1.18 -//     ///\param G is the graph, to which
    1.19 -//     ///we would like to define the \ref PredNodeMap
    1.20 -//     static PredNodeMap *createPredNodeMap(const GR &G)
    1.21 -//     {
    1.22 -//       return new PredNodeMap();
    1.23 -//     }
    1.24  
    1.25      ///The type of the map that indicates which nodes are processed.
    1.26   
    1.27 @@ -179,9 +162,6 @@
    1.28      ///\brief The type of the map that stores the last
    1.29      ///edges of the %DFS paths.
    1.30      typedef typename TR::PredMap PredMap;
    1.31 -//     ///\brief The type of the map that stores the last but one
    1.32 -//     ///nodes of the %DFS paths.
    1.33 -//     typedef typename TR::PredNodeMap PredNodeMap;
    1.34      ///The type of the map indicating which nodes are reached.
    1.35      typedef typename TR::ReachedMap ReachedMap;
    1.36      ///The type of the map indicating which nodes are processed.
    1.37 @@ -195,10 +175,6 @@
    1.38      PredMap *_pred;
    1.39      ///Indicates if \ref _pred is locally allocated (\c true) or not.
    1.40      bool local_pred;
    1.41 -//     ///Pointer to the map of predecessors nodes.
    1.42 -//     PredNodeMap *_predNode;
    1.43 -//     ///Indicates if \ref _predNode is locally allocated (\c true) or not.
    1.44 -//     bool local_predNode;
    1.45      ///Pointer to the map of distances.
    1.46      DistMap *_dist;
    1.47      ///Indicates if \ref _dist is locally allocated (\c true) or not.
    1.48 @@ -214,8 +190,6 @@
    1.49  
    1.50      std::vector<typename Graph::OutEdgeIt> _stack;
    1.51      int _stack_head;
    1.52 -//     ///The source node of the last execution.
    1.53 -//     Node source;
    1.54  
    1.55      ///Creates the maps if necessary.
    1.56      
    1.57 @@ -227,10 +201,6 @@
    1.58  	local_pred = true;
    1.59  	_pred = Traits::createPredMap(*G);
    1.60        }
    1.61 -//       if(!_predNode) {
    1.62 -// 	local_predNode = true;
    1.63 -// 	_predNode = Traits::createPredNodeMap(*G);
    1.64 -//       }
    1.65        if(!_dist) {
    1.66  	local_dist = true;
    1.67  	_dist = Traits::createDistMap(*G);
    1.68 @@ -246,7 +216,9 @@
    1.69      }
    1.70      
    1.71    public :
    1.72 - 
    1.73 +
    1.74 +    typedef Dfs Create;
    1.75 +
    1.76      ///\name Named template parameters
    1.77  
    1.78      ///@{
    1.79 @@ -264,25 +236,10 @@
    1.80      ///\ref named-templ-param "Named parameter" for setting PredMap type
    1.81      ///
    1.82      template <class T>
    1.83 -    class DefPredMap : public Dfs< Graph,
    1.84 -					DefPredMapTraits<T> > { };
    1.85 +    struct DefPredMap : public Dfs<Graph, DefPredMapTraits<T> > {
    1.86 +      typedef Dfs<Graph, DefPredMapTraits<T> > Create;
    1.87 +    };
    1.88      
    1.89 -//     template <class T>
    1.90 -//     struct DefPredNodeMapTraits : public Traits {
    1.91 -//       typedef T PredNodeMap;
    1.92 -//       static PredNodeMap *createPredNodeMap(const Graph &G) 
    1.93 -//       {
    1.94 -// 	throw UninitializedParameter();
    1.95 -//       }
    1.96 -//     };
    1.97 -//     ///\ref named-templ-param "Named parameter" for setting PredNodeMap type
    1.98 -
    1.99 -//     ///\ref named-templ-param "Named parameter" for setting PredNodeMap type
   1.100 -//     ///
   1.101 -//     template <class T>
   1.102 -//     class DefPredNodeMap : public Dfs< Graph,
   1.103 -// 					    LengthMap,
   1.104 -// 					    DefPredNodeMapTraits<T> > { };
   1.105      
   1.106      template <class T>
   1.107      struct DefDistMapTraits : public Traits {
   1.108 @@ -297,8 +254,9 @@
   1.109      ///\ref named-templ-param "Named parameter" for setting DistMap type
   1.110      ///
   1.111      template <class T>
   1.112 -    class DefDistMap : public Dfs< Graph,
   1.113 -				   DefDistMapTraits<T> > { };
   1.114 +    struct DefDistMap {
   1.115 +      typedef Dfs<Graph, DefDistMapTraits<T> > Create;
   1.116 +    };
   1.117      
   1.118      template <class T>
   1.119      struct DefReachedMapTraits : public Traits {
   1.120 @@ -313,16 +271,10 @@
   1.121      ///\ref named-templ-param "Named parameter" for setting ReachedMap type
   1.122      ///
   1.123      template <class T>
   1.124 -    class DefReachedMap : public Dfs< Graph,
   1.125 -				      DefReachedMapTraits<T> > { };
   1.126 -    
   1.127 -    struct DefGraphReachedMapTraits : public Traits {
   1.128 -      typedef typename Graph::template NodeMap<bool> ReachedMap;
   1.129 -      static ReachedMap *createReachedMap(const Graph &G) 
   1.130 -      {
   1.131 -	return new ReachedMap(G);
   1.132 -      }
   1.133 +    struct DefReachedMap {
   1.134 +      typedef Dfs< Graph, DefReachedMapTraits<T> > Create;
   1.135      };
   1.136 +
   1.137      template <class T>
   1.138      struct DefProcessedMapTraits : public Traits {
   1.139        typedef T ProcessedMap;
   1.140 @@ -337,7 +289,7 @@
   1.141      ///
   1.142      template <class T>
   1.143      struct DefProcessedMap : public Dfs< Graph, DefProcessedMapTraits<T> > { 
   1.144 -      typedef Dfs< Graph, DefProcessedMapTraits<T> > Dfs;
   1.145 +      typedef Dfs< Graph, DefProcessedMapTraits<T> > Create;
   1.146      };
   1.147      
   1.148      struct DefGraphProcessedMapTraits : public Traits {
   1.149 @@ -355,8 +307,9 @@
   1.150      ///If you don't set it explicitely, it will be automatically allocated.
   1.151      template <class T>
   1.152      class DefProcessedMapToBeDefaultMap :
   1.153 -      public Dfs< Graph,
   1.154 -		  DefGraphProcessedMapTraits> { };
   1.155 +      public Dfs< Graph, DefGraphProcessedMapTraits> { 
   1.156 +      typedef Dfs< Graph, DefGraphProcessedMapTraits> Create;
   1.157 +    };
   1.158      
   1.159      ///@}
   1.160