lemon/grid_graph.h
changeset 782 ceb2756dea2a
parent 617 4137ef9aacc6
child 787 c2230649a493
     1.1 --- a/lemon/grid_graph.h	Mon Sep 28 15:53:20 2009 +0200
     1.2 +++ b/lemon/grid_graph.h	Thu Nov 05 10:27:17 2009 +0100
     1.3 @@ -470,18 +470,22 @@
     1.4    ///
     1.5    /// \brief Grid graph class
     1.6    ///
     1.7 -  /// This class implements a special graph type. The nodes of the
     1.8 -  /// graph can be indexed by two integer \c (i,j) value where \c i is
     1.9 -  /// in the \c [0..width()-1] range and j is in the \c
    1.10 -  /// [0..height()-1] range.  Two nodes are connected in the graph if
    1.11 -  /// the indexes differ exactly on one position and exactly one is
    1.12 -  /// the difference. The nodes of the graph can be indexed by position
    1.13 -  /// with the \c operator()() function. The positions of the nodes can be
    1.14 -  /// get with \c pos(), \c col() and \c row() members. The outgoing
    1.15 +  /// GridGraph implements a special graph type. The nodes of the
    1.16 +  /// graph can be indexed by two integer values \c (i,j) where \c i is
    1.17 +  /// in the range <tt>[0..width()-1]</tt> and j is in the range
    1.18 +  /// <tt>[0..height()-1]</tt>. Two nodes are connected in the graph if
    1.19 +  /// the indices differ exactly on one position and the difference is
    1.20 +  /// also exactly one. The nodes of the graph can be obtained by position
    1.21 +  /// using the \c operator()() function and the indices of the nodes can
    1.22 +  /// be obtained using \c pos(), \c col() and \c row() members. The outgoing
    1.23    /// arcs can be retrieved with the \c right(), \c up(), \c left()
    1.24    /// and \c down() functions, where the bottom-left corner is the
    1.25    /// origin.
    1.26    ///
    1.27 +  /// This class is completely static and it needs constant memory space.
    1.28 +  /// Thus you can neither add nor delete nodes or edges, however
    1.29 +  /// the structure can be resized using resize().
    1.30 +  ///
    1.31    /// \image html grid_graph.png
    1.32    /// \image latex grid_graph.eps "Grid graph" width=\textwidth
    1.33    ///
    1.34 @@ -496,16 +500,19 @@
    1.35    /// }
    1.36    ///\endcode
    1.37    ///
    1.38 -  /// This graph type fully conforms to the \ref concepts::Graph
    1.39 -  /// "Graph concept".
    1.40 +  /// This type fully conforms to the \ref concepts::Graph "Graph concept".
    1.41 +  /// Most of its member functions and nested classes are documented
    1.42 +  /// only in the concept class.
    1.43    class GridGraph : public ExtendedGridGraphBase {
    1.44      typedef ExtendedGridGraphBase Parent;
    1.45  
    1.46    public:
    1.47  
    1.48 -    /// \brief Map to get the indices of the nodes as dim2::Point<int>.
    1.49 +    /// \brief Map to get the indices of the nodes as \ref dim2::Point
    1.50 +    /// "dim2::Point<int>".
    1.51      ///
    1.52 -    /// Map to get the indices of the nodes as dim2::Point<int>.
    1.53 +    /// Map to get the indices of the nodes as \ref dim2::Point
    1.54 +    /// "dim2::Point<int>".
    1.55      class IndexMap {
    1.56      public:
    1.57        /// \brief The key type of the map
    1.58 @@ -514,13 +521,9 @@
    1.59        typedef dim2::Point<int> Value;
    1.60  
    1.61        /// \brief Constructor
    1.62 -      ///
    1.63 -      /// Constructor
    1.64        IndexMap(const GridGraph& graph) : _graph(graph) {}
    1.65  
    1.66        /// \brief The subscript operator
    1.67 -      ///
    1.68 -      /// The subscript operator.
    1.69        Value operator[](Key key) const {
    1.70          return _graph.pos(key);
    1.71        }
    1.72 @@ -540,13 +543,9 @@
    1.73        typedef int Value;
    1.74  
    1.75        /// \brief Constructor
    1.76 -      ///
    1.77 -      /// Constructor
    1.78        ColMap(const GridGraph& graph) : _graph(graph) {}
    1.79  
    1.80        /// \brief The subscript operator
    1.81 -      ///
    1.82 -      /// The subscript operator.
    1.83        Value operator[](Key key) const {
    1.84          return _graph.col(key);
    1.85        }
    1.86 @@ -566,13 +565,9 @@
    1.87        typedef int Value;
    1.88  
    1.89        /// \brief Constructor
    1.90 -      ///
    1.91 -      /// Constructor
    1.92        RowMap(const GridGraph& graph) : _graph(graph) {}
    1.93  
    1.94        /// \brief The subscript operator
    1.95 -      ///
    1.96 -      /// The subscript operator.
    1.97        Value operator[](Key key) const {
    1.98          return _graph.row(key);
    1.99        }
   1.100 @@ -583,15 +578,14 @@
   1.101  
   1.102      /// \brief Constructor
   1.103      ///
   1.104 -    /// Construct a grid graph with given size.
   1.105 +    /// Construct a grid graph with the given size.
   1.106      GridGraph(int width, int height) { construct(width, height); }
   1.107  
   1.108 -    /// \brief Resize the graph
   1.109 +    /// \brief Resizes the graph
   1.110      ///
   1.111 -    /// Resize the graph. The function will fully destroy and rebuild
   1.112 -    /// the graph.  This cause that the maps of the graph will
   1.113 -    /// reallocated automatically and the previous values will be
   1.114 -    /// lost.
   1.115 +    /// This function resizes the graph. It fully destroys and
   1.116 +    /// rebuilds the structure, therefore the maps of the graph will be
   1.117 +    /// reallocated automatically and the previous values will be lost.
   1.118      void resize(int width, int height) {
   1.119        Parent::notifier(Arc()).clear();
   1.120        Parent::notifier(Edge()).clear();
   1.121 @@ -609,42 +603,42 @@
   1.122        return Parent::operator()(i, j);
   1.123      }
   1.124  
   1.125 -    /// \brief Gives back the column index of the node.
   1.126 +    /// \brief The column index of the node.
   1.127      ///
   1.128      /// Gives back the column index of the node.
   1.129      int col(Node n) const {
   1.130        return Parent::col(n);
   1.131      }
   1.132  
   1.133 -    /// \brief Gives back the row index of the node.
   1.134 +    /// \brief The row index of the node.
   1.135      ///
   1.136      /// Gives back the row index of the node.
   1.137      int row(Node n) const {
   1.138        return Parent::row(n);
   1.139      }
   1.140  
   1.141 -    /// \brief Gives back the position of the node.
   1.142 +    /// \brief The position of the node.
   1.143      ///
   1.144      /// Gives back the position of the node, ie. the <tt>(col,row)</tt> pair.
   1.145      dim2::Point<int> pos(Node n) const {
   1.146        return Parent::pos(n);
   1.147      }
   1.148  
   1.149 -    /// \brief Gives back the number of the columns.
   1.150 +    /// \brief The number of the columns.
   1.151      ///
   1.152      /// Gives back the number of the columns.
   1.153      int width() const {
   1.154        return Parent::width();
   1.155      }
   1.156  
   1.157 -    /// \brief Gives back the number of the rows.
   1.158 +    /// \brief The number of the rows.
   1.159      ///
   1.160      /// Gives back the number of the rows.
   1.161      int height() const {
   1.162        return Parent::height();
   1.163      }
   1.164  
   1.165 -    /// \brief Gives back the arc goes right from the node.
   1.166 +    /// \brief The arc goes right from the node.
   1.167      ///
   1.168      /// Gives back the arc goes right from the node. If there is not
   1.169      /// outgoing arc then it gives back INVALID.
   1.170 @@ -652,7 +646,7 @@
   1.171        return Parent::right(n);
   1.172      }
   1.173  
   1.174 -    /// \brief Gives back the arc goes left from the node.
   1.175 +    /// \brief The arc goes left from the node.
   1.176      ///
   1.177      /// Gives back the arc goes left from the node. If there is not
   1.178      /// outgoing arc then it gives back INVALID.
   1.179 @@ -660,7 +654,7 @@
   1.180        return Parent::left(n);
   1.181      }
   1.182  
   1.183 -    /// \brief Gives back the arc goes up from the node.
   1.184 +    /// \brief The arc goes up from the node.
   1.185      ///
   1.186      /// Gives back the arc goes up from the node. If there is not
   1.187      /// outgoing arc then it gives back INVALID.
   1.188 @@ -668,7 +662,7 @@
   1.189        return Parent::up(n);
   1.190      }
   1.191  
   1.192 -    /// \brief Gives back the arc goes down from the node.
   1.193 +    /// \brief The arc goes down from the node.
   1.194      ///
   1.195      /// Gives back the arc goes down from the node. If there is not
   1.196      /// outgoing arc then it gives back INVALID.