lemon/grid_graph.h
changeset 336 052cecabcb71
parent 335 160bf92c7cdc
child 338 b77fb8c32707
equal deleted inserted replaced
1:aebd3c450cad 2:a1b77f05dd8f
   182       bool operator<(const Node node) const {return _id < node._id;}
   182       bool operator<(const Node node) const {return _id < node._id;}
   183     };
   183     };
   184 
   184 
   185     class Edge {
   185     class Edge {
   186       friend class GridGraphBase;
   186       friend class GridGraphBase;
       
   187       friend class Arc;
   187 
   188 
   188     protected:
   189     protected:
   189       int _id;
   190       int _id;
   190 
   191 
   191       Edge(int id) : _id(id) {}
   192       Edge(int id) : _id(id) {}
   470   /// This class implements a special graph type. The nodes of the
   471   /// This class implements a special graph type. The nodes of the
   471   /// graph can be indexed by two integer \c (i,j) value where \c i is
   472   /// graph can be indexed by two integer \c (i,j) value where \c i is
   472   /// in the \c [0..width()-1] range and j is in the \c
   473   /// in the \c [0..width()-1] range and j is in the \c
   473   /// [0..height()-1] range.  Two nodes are connected in the graph if
   474   /// [0..height()-1] range.  Two nodes are connected in the graph if
   474   /// the indexes differ exactly on one position and exactly one is
   475   /// the indexes differ exactly on one position and exactly one is
   475   /// the difference. The nodes of the graph be indexed by position
   476   /// the difference. The nodes of the graph can be indexed by position
   476   /// with \c operator()() function. The positions of the nodes can be
   477   /// with the \c operator()() function. The positions of the nodes can be
   477   /// get with \c pos(), \c col() and \c row() members. The outgoing
   478   /// get with \c pos(), \c col() and \c row() members. The outgoing
   478   /// arcs can be retrieved with the \c right(), \c up(), \c left()
   479   /// arcs can be retrieved with the \c right(), \c up(), \c left()
   479   /// and \c down() functions, where the bottom-left corner is the
   480   /// and \c down() functions, where the bottom-left corner is the
   480   /// origin.
   481   /// origin.
   481   ///
   482   ///
   482   /// \image html grid_graph.png
   483   /// \image html grid_graph.png
   483   /// \image latex grid_graph.eps "Grid digraph" row_num=\textrow_num
   484   /// \image latex grid_graph.eps "Grid graph" row_num=\textrow_num
   484   ///
   485   ///
   485   /// A short example about the basic usage:
   486   /// A short example about the basic usage:
   486   ///\code
   487   ///\code
   487   /// GridGraph graph(rows, cols);
   488   /// GridGraph graph(rows, cols);
   488   /// GridGraph::NodeMap<int> val(graph);
   489   /// GridGraph::NodeMap<int> val(graph);
   491   ///     val[graph(i, j)] = i + j;
   492   ///     val[graph(i, j)] = i + j;
   492   ///   }
   493   ///   }
   493   /// }
   494   /// }
   494   ///\endcode
   495   ///\endcode
   495   ///
   496   ///
   496   /// The graph type is fully conform to the \ref concepts::Graph
   497   /// This graph type is fully conform to the \ref concepts::Graph
   497   /// "Graph" concept, and it also has an important extra feature
   498   /// "Graph" concept, and it also has an important extra feature
   498   /// that its maps are real \ref concepts::ReferenceMap "reference
   499   /// that its maps are real \ref concepts::ReferenceMap
   499   /// map"s.
   500   /// "reference map"s.
   500   class GridGraph : public ExtendedGridGraphBase {
   501   class GridGraph : public ExtendedGridGraphBase {
   501   public:
   502   public:
   502 
   503 
   503     typedef ExtendedGridGraphBase Parent;
   504     typedef ExtendedGridGraphBase Parent;
   504 
   505