- Changes in doc
authoralpar
Sun, 05 Sep 2004 20:11:47 +0000
changeset 802bc0c74eeb151
parent 801 48638058e188
child 803 c3d832275e69
- Changes in doc
- setGraph(...) finally removed from Dijkstra, Bfs and Dfs.
src/hugo/bfs.h
src/hugo/dfs.h
src/hugo/dijkstra.h
     1.1 --- a/src/hugo/bfs.h	Sun Sep 05 20:06:08 2004 +0000
     1.2 +++ b/src/hugo/bfs.h	Sun Sep 05 20:11:47 2004 +0000
     1.3 @@ -34,9 +34,13 @@
     1.4    public:
     1.5      ///The type of the underlying graph.
     1.6      typedef GR Graph;
     1.7 +    ///.
     1.8      typedef typename Graph::Node Node;
     1.9 +    ///.
    1.10      typedef typename Graph::NodeIt NodeIt;
    1.11 +    ///.
    1.12      typedef typename Graph::Edge Edge;
    1.13 +    ///.
    1.14      typedef typename Graph::OutEdgeIt OutEdgeIt;
    1.15      
    1.16      ///\brief The type of the map that stores the last
    1.17 @@ -49,15 +53,22 @@
    1.18      typedef typename Graph::template NodeMap<int> DistMap;
    1.19  
    1.20    private:
    1.21 +    /// Pointer to the underlying graph.
    1.22      const Graph *G;
    1.23 +    ///Pointer to the map of predecessors edges.
    1.24      PredMap *predecessor;
    1.25 +    ///Indicates if \ref predecessor is locally allocated (\c true) or not.
    1.26      bool local_predecessor;
    1.27 +    ///Pointer to the map of predecessors nodes.
    1.28      PredNodeMap *pred_node;
    1.29 +    ///Indicates if \ref pred_node is locally allocated (\c true) or not.
    1.30      bool local_pred_node;
    1.31 +    ///Pointer to the map of distances.
    1.32      DistMap *distance;
    1.33 +    ///Indicates if \ref distance is locally allocated (\c true) or not.
    1.34      bool local_distance;
    1.35  
    1.36 -    //The source node of the last execution.
    1.37 +    ///The source node of the last execution.
    1.38      Node source;
    1.39  
    1.40  
    1.41 @@ -79,6 +90,9 @@
    1.42      }
    1.43      
    1.44    public :    
    1.45 +    ///Constructor.
    1.46 +    
    1.47 +    ///\param _G the graph the algorithm will run on.
    1.48      Bfs(const Graph& _G) :
    1.49        G(&_G),
    1.50        predecessor(NULL), local_predecessor(false),
    1.51 @@ -86,6 +100,7 @@
    1.52        distance(NULL), local_distance(false)
    1.53      { }
    1.54      
    1.55 +    ///Destructor.
    1.56      ~Bfs() 
    1.57      {
    1.58        if(local_predecessor) delete predecessor;
    1.59 @@ -93,17 +108,6 @@
    1.60        if(local_distance) delete distance;
    1.61      }
    1.62  
    1.63 -    ///Sets the graph the algorithm will run on.
    1.64 -
    1.65 -    ///Sets the graph the algorithm will run on.
    1.66 -    ///\return <tt> (*this) </tt>
    1.67 -    ///\bug What about maps?
    1.68 -    ///\todo It may be unnecessary
    1.69 -    Bfs &setGraph(const Graph &_G) 
    1.70 -    {
    1.71 -      G = &_G;
    1.72 -      return *this;
    1.73 -    }
    1.74      ///Sets the map storing the predecessor edges.
    1.75  
    1.76      ///Sets the map storing the predecessor edges.
    1.77 @@ -249,7 +253,7 @@
    1.78      ///Checks if a node is reachable from the root.
    1.79  
    1.80      ///Returns \c true if \c v is reachable from the root.
    1.81 -    ///\warning The root node is reported to be reached!
    1.82 +    ///\note The root node is reported to be reached!
    1.83      ///
    1.84      ///\pre \ref run() must be called before using this function.
    1.85      ///
     2.1 --- a/src/hugo/dfs.h	Sun Sep 05 20:06:08 2004 +0000
     2.2 +++ b/src/hugo/dfs.h	Sun Sep 05 20:11:47 2004 +0000
     2.3 @@ -33,9 +33,13 @@
     2.4    public:
     2.5      ///The type of the underlying graph.
     2.6      typedef GR Graph;
     2.7 +    /// .
     2.8      typedef typename Graph::Node Node;
     2.9 +    /// .
    2.10      typedef typename Graph::NodeIt NodeIt;
    2.11 +    /// .
    2.12      typedef typename Graph::Edge Edge;
    2.13 +    /// .
    2.14      typedef typename Graph::OutEdgeIt OutEdgeIt;
    2.15      
    2.16      ///\brief The type of the map that stores the last
    2.17 @@ -48,15 +52,22 @@
    2.18      typedef typename Graph::template NodeMap<int> DistMap;
    2.19  
    2.20    private:
    2.21 +    /// Pointer to the underlying graph.
    2.22      const Graph *G;
    2.23 +    ///Pointer to the map of predecessors edges.
    2.24      PredMap *predecessor;
    2.25 +    ///Indicates if \ref predecessor is locally allocated (\c true) or not.
    2.26      bool local_predecessor;
    2.27 +    ///Pointer to the map of predecessors nodes.
    2.28      PredNodeMap *pred_node;
    2.29 +    ///Indicates if \ref pred_node is locally allocated (\c true) or not.
    2.30      bool local_pred_node;
    2.31 +    ///Pointer to the map of distances.
    2.32      DistMap *distance;
    2.33 +    ///Indicates if \ref distance is locally allocated (\c true) or not.
    2.34      bool local_distance;
    2.35  
    2.36 -    //The source node of the last execution.
    2.37 +    ///The source node of the last execution.
    2.38      Node source;
    2.39  
    2.40  
    2.41 @@ -78,6 +89,9 @@
    2.42      }
    2.43      
    2.44    public :    
    2.45 +    ///Constructor.
    2.46 +    
    2.47 +    ///\param _G the graph the algorithm will run on.
    2.48      Dfs(const Graph& _G) :
    2.49        G(&_G),
    2.50        predecessor(NULL), local_predecessor(false),
    2.51 @@ -85,6 +99,7 @@
    2.52        distance(NULL), local_distance(false)
    2.53      { }
    2.54      
    2.55 +    ///Destructor.
    2.56      ~Dfs() 
    2.57      {
    2.58        if(local_predecessor) delete predecessor;
    2.59 @@ -92,17 +107,6 @@
    2.60        if(local_distance) delete distance;
    2.61      }
    2.62  
    2.63 -    ///Sets the graph the algorithm will run on.
    2.64 -
    2.65 -    ///Sets the graph the algorithm will run on.
    2.66 -    ///\return <tt> (*this) </tt>
    2.67 -    ///\bug What about maps?
    2.68 -    ///\todo It may be unnecessary
    2.69 -    Dfs &setGraph(const Graph &_G) 
    2.70 -    {
    2.71 -      G = &_G;
    2.72 -      return *this;
    2.73 -    }
    2.74      ///Sets the map storing the predecessor edges.
    2.75  
    2.76      ///Sets the map storing the predecessor edges.
    2.77 @@ -253,7 +257,7 @@
    2.78      ///Checks if a node is reachable from the root.
    2.79  
    2.80      ///Returns \c true if \c v is reachable from the root.
    2.81 -    ///\warning The root node is reported to be reached!
    2.82 +    ///\note The root node is reported to be reached!
    2.83      ///
    2.84      ///\pre \ref run() must be called before using this function.
    2.85      ///
     3.1 --- a/src/hugo/dijkstra.h	Sun Sep 05 20:06:08 2004 +0000
     3.2 +++ b/src/hugo/dijkstra.h	Sun Sep 05 20:11:47 2004 +0000
     3.3 @@ -55,9 +55,13 @@
     3.4    public:
     3.5      ///The type of the underlying graph.
     3.6      typedef GR Graph;
     3.7 +    ///.
     3.8      typedef typename Graph::Node Node;
     3.9 +    ///.
    3.10      typedef typename Graph::NodeIt NodeIt;
    3.11 +    ///.
    3.12      typedef typename Graph::Edge Edge;
    3.13 +    ///.
    3.14      typedef typename Graph::OutEdgeIt OutEdgeIt;
    3.15      
    3.16      ///The type of the length of the edges.
    3.17 @@ -74,17 +78,24 @@
    3.18      typedef typename Graph::template NodeMap<ValueType> DistMap;
    3.19  
    3.20    private:
    3.21 +    /// Pointer to the underlying graph.
    3.22      const Graph *G;
    3.23 +    /// Pointer to the length map
    3.24      const LM *length;
    3.25 -    //    bool local_length;
    3.26 +    ///Pointer to the map of predecessors edges.
    3.27      PredMap *predecessor;
    3.28 +    ///Indicates if \ref predecessor is locally allocated (\c true) or not.
    3.29      bool local_predecessor;
    3.30 +    ///Pointer to the map of predecessors nodes.
    3.31      PredNodeMap *pred_node;
    3.32 +    ///Indicates if \ref pred_node is locally allocated (\c true) or not.
    3.33      bool local_pred_node;
    3.34 +    ///Pointer to the map of distances.
    3.35      DistMap *distance;
    3.36 +    ///Indicates if \ref distance is locally allocated (\c true) or not.
    3.37      bool local_distance;
    3.38  
    3.39 -    //The source node of the last execution.
    3.40 +    ///The source node of the last execution.
    3.41      Node source;
    3.42  
    3.43      ///Initializes the maps.
    3.44 @@ -93,10 +104,6 @@
    3.45      ///\todo Better memory allocation (instead of new).
    3.46      void init_maps() 
    3.47      {
    3.48 -//       if(!length) {
    3.49 -// 	local_length = true;
    3.50 -// 	length = new LM(G);
    3.51 -//       }
    3.52        if(!predecessor) {
    3.53  	local_predecessor = true;
    3.54  	predecessor = new PredMap(*G);
    3.55 @@ -112,7 +119,10 @@
    3.56      }
    3.57      
    3.58    public :
    3.59 +    ///Constructor.
    3.60      
    3.61 +    ///\param _G the graph the algorithm will run on.
    3.62 +    ///\param _length the length map used by the algorithm.
    3.63      Dijkstra(const Graph& _G, const LM& _length) :
    3.64        G(&_G), length(&_length),
    3.65        predecessor(NULL), local_predecessor(false),
    3.66 @@ -120,35 +130,20 @@
    3.67        distance(NULL), local_distance(false)
    3.68      { }
    3.69      
    3.70 +    ///Destructor.
    3.71      ~Dijkstra() 
    3.72      {
    3.73 -      //      if(local_length) delete length;
    3.74        if(local_predecessor) delete predecessor;
    3.75        if(local_pred_node) delete pred_node;
    3.76        if(local_distance) delete distance;
    3.77      }
    3.78  
    3.79 -    ///Sets the graph the algorithm will run on.
    3.80 -
    3.81 -    ///Sets the graph the algorithm will run on.
    3.82 -    ///\return <tt> (*this) </tt>
    3.83 -    ///\bug What about maps?
    3.84 -    ///\todo It may be unnecessary
    3.85 -    Dijkstra &setGraph(const Graph &_G) 
    3.86 -    {
    3.87 -      G = &_G;
    3.88 -      return *this;
    3.89 -    }
    3.90      ///Sets the length map.
    3.91  
    3.92      ///Sets the length map.
    3.93      ///\return <tt> (*this) </tt>
    3.94      Dijkstra &setLengthMap(const LM &m) 
    3.95      {
    3.96 -//       if(local_length) {
    3.97 -// 	delete length;
    3.98 -// 	local_length=false;
    3.99 -//       }
   3.100        length = &m;
   3.101        return *this;
   3.102      }
   3.103 @@ -317,7 +312,7 @@
   3.104      ///Checks if a node is reachable from the root.
   3.105  
   3.106      ///Returns \c true if \c v is reachable from the root.
   3.107 -    ///\warning the root node is reported to be reached!
   3.108 +    ///\note The root node is reported to be reached!
   3.109      ///\pre \ref run() must be called before using this function.
   3.110      ///
   3.111      bool reached(Node v) { return v==source || (*predecessor)[v]!=INVALID; }