lemon/grid_graph.h
changeset 783 ef88c0a30f85
parent 617 4137ef9aacc6
child 787 c2230649a493
     1.1 --- a/lemon/grid_graph.h	Mon Jan 12 23:11:39 2009 +0100
     1.2 +++ b/lemon/grid_graph.h	Thu Nov 05 15:48:01 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,18 +500,19 @@
    1.35    /// }
    1.36    ///\endcode
    1.37    ///
    1.38 -  /// This graph type is fully conform to the \ref concepts::Graph
    1.39 -  /// "Graph" concept, and it also has an important extra feature
    1.40 -  /// that its maps are real \ref concepts::ReferenceMap
    1.41 -  /// "reference map"s.
    1.42 +  /// This type fully conforms to the \ref concepts::Graph "Graph concept".
    1.43 +  /// Most of its member functions and nested classes are documented
    1.44 +  /// only in the concept class.
    1.45    class GridGraph : public ExtendedGridGraphBase {
    1.46 +    typedef ExtendedGridGraphBase Parent;
    1.47 +
    1.48    public:
    1.49  
    1.50 -    typedef ExtendedGridGraphBase Parent;
    1.51 -
    1.52 -    /// \brief Map to get the indices of the nodes as dim2::Point<int>.
    1.53 +    /// \brief Map to get the indices of the nodes as \ref dim2::Point
    1.54 +    /// "dim2::Point<int>".
    1.55      ///
    1.56 -    /// Map to get the indices of the nodes as dim2::Point<int>.
    1.57 +    /// Map to get the indices of the nodes as \ref dim2::Point
    1.58 +    /// "dim2::Point<int>".
    1.59      class IndexMap {
    1.60      public:
    1.61        /// \brief The key type of the map
    1.62 @@ -516,13 +521,9 @@
    1.63        typedef dim2::Point<int> Value;
    1.64  
    1.65        /// \brief Constructor
    1.66 -      ///
    1.67 -      /// Constructor
    1.68        IndexMap(const GridGraph& graph) : _graph(graph) {}
    1.69  
    1.70        /// \brief The subscript operator
    1.71 -      ///
    1.72 -      /// The subscript operator.
    1.73        Value operator[](Key key) const {
    1.74          return _graph.pos(key);
    1.75        }
    1.76 @@ -542,13 +543,9 @@
    1.77        typedef int Value;
    1.78  
    1.79        /// \brief Constructor
    1.80 -      ///
    1.81 -      /// Constructor
    1.82        ColMap(const GridGraph& graph) : _graph(graph) {}
    1.83  
    1.84        /// \brief The subscript operator
    1.85 -      ///
    1.86 -      /// The subscript operator.
    1.87        Value operator[](Key key) const {
    1.88          return _graph.col(key);
    1.89        }
    1.90 @@ -568,13 +565,9 @@
    1.91        typedef int Value;
    1.92  
    1.93        /// \brief Constructor
    1.94 -      ///
    1.95 -      /// Constructor
    1.96        RowMap(const GridGraph& graph) : _graph(graph) {}
    1.97  
    1.98        /// \brief The subscript operator
    1.99 -      ///
   1.100 -      /// The subscript operator.
   1.101        Value operator[](Key key) const {
   1.102          return _graph.row(key);
   1.103        }
   1.104 @@ -585,15 +578,14 @@
   1.105  
   1.106      /// \brief Constructor
   1.107      ///
   1.108 -    /// Construct a grid graph with given size.
   1.109 +    /// Construct a grid graph with the given size.
   1.110      GridGraph(int width, int height) { construct(width, height); }
   1.111  
   1.112 -    /// \brief Resize the graph
   1.113 +    /// \brief Resizes the graph
   1.114      ///
   1.115 -    /// Resize the graph. The function will fully destroy and rebuild
   1.116 -    /// the graph.  This cause that the maps of the graph will
   1.117 -    /// reallocated automatically and the previous values will be
   1.118 -    /// lost.
   1.119 +    /// This function resizes the graph. It fully destroys and
   1.120 +    /// rebuilds the structure, therefore the maps of the graph will be
   1.121 +    /// reallocated automatically and the previous values will be lost.
   1.122      void resize(int width, int height) {
   1.123        Parent::notifier(Arc()).clear();
   1.124        Parent::notifier(Edge()).clear();
   1.125 @@ -611,42 +603,42 @@
   1.126        return Parent::operator()(i, j);
   1.127      }
   1.128  
   1.129 -    /// \brief Gives back the column index of the node.
   1.130 +    /// \brief The column index of the node.
   1.131      ///
   1.132      /// Gives back the column index of the node.
   1.133      int col(Node n) const {
   1.134        return Parent::col(n);
   1.135      }
   1.136  
   1.137 -    /// \brief Gives back the row index of the node.
   1.138 +    /// \brief The row index of the node.
   1.139      ///
   1.140      /// Gives back the row index of the node.
   1.141      int row(Node n) const {
   1.142        return Parent::row(n);
   1.143      }
   1.144  
   1.145 -    /// \brief Gives back the position of the node.
   1.146 +    /// \brief The position of the node.
   1.147      ///
   1.148      /// Gives back the position of the node, ie. the <tt>(col,row)</tt> pair.
   1.149      dim2::Point<int> pos(Node n) const {
   1.150        return Parent::pos(n);
   1.151      }
   1.152  
   1.153 -    /// \brief Gives back the number of the columns.
   1.154 +    /// \brief The number of the columns.
   1.155      ///
   1.156      /// Gives back the number of the columns.
   1.157      int width() const {
   1.158        return Parent::width();
   1.159      }
   1.160  
   1.161 -    /// \brief Gives back the number of the rows.
   1.162 +    /// \brief The number of the rows.
   1.163      ///
   1.164      /// Gives back the number of the rows.
   1.165      int height() const {
   1.166        return Parent::height();
   1.167      }
   1.168  
   1.169 -    /// \brief Gives back the arc goes right from the node.
   1.170 +    /// \brief The arc goes right from the node.
   1.171      ///
   1.172      /// Gives back the arc goes right from the node. If there is not
   1.173      /// outgoing arc then it gives back INVALID.
   1.174 @@ -654,7 +646,7 @@
   1.175        return Parent::right(n);
   1.176      }
   1.177  
   1.178 -    /// \brief Gives back the arc goes left from the node.
   1.179 +    /// \brief The arc goes left from the node.
   1.180      ///
   1.181      /// Gives back the arc goes left from the node. If there is not
   1.182      /// outgoing arc then it gives back INVALID.
   1.183 @@ -662,7 +654,7 @@
   1.184        return Parent::left(n);
   1.185      }
   1.186  
   1.187 -    /// \brief Gives back the arc goes up from the node.
   1.188 +    /// \brief The arc goes up from the node.
   1.189      ///
   1.190      /// Gives back the arc goes up from the node. If there is not
   1.191      /// outgoing arc then it gives back INVALID.
   1.192 @@ -670,7 +662,7 @@
   1.193        return Parent::up(n);
   1.194      }
   1.195  
   1.196 -    /// \brief Gives back the arc goes down from the node.
   1.197 +    /// \brief The arc goes down from the node.
   1.198      ///
   1.199      /// Gives back the arc goes down from the node. If there is not
   1.200      /// outgoing arc then it gives back INVALID.