lemon/grid_ugraph.h
changeset 2222 a24939ee343c
parent 2151 38ec4a930c05
child 2223 590c1b663a27
equal deleted inserted replaced
8:da47df7a652f 9:1592d344e597
    24 #include <lemon/bits/utility.h>
    24 #include <lemon/bits/utility.h>
    25 
    25 
    26 #include <lemon/bits/base_extender.h>
    26 #include <lemon/bits/base_extender.h>
    27 #include <lemon/bits/graph_extender.h>
    27 #include <lemon/bits/graph_extender.h>
    28 
    28 
    29 #include <lemon/xy.h>
    29 #include <lemon/dim2.h>
    30 
    30 
    31 ///\ingroup graphs
    31 ///\ingroup graphs
    32 ///\file
    32 ///\file
    33 ///\brief GridUGraph class.
    33 ///\brief GridUGraph class.
    34 
    34 
   379   class GridUGraph : public ExtendedGridUGraphBase {
   379   class GridUGraph : public ExtendedGridUGraphBase {
   380   public:
   380   public:
   381 
   381 
   382     typedef ExtendedGridUGraphBase Parent;
   382     typedef ExtendedGridUGraphBase Parent;
   383 
   383 
   384     /// \brief Map to get the indices of the nodes as xy<int>.
   384     /// \brief Map to get the indices of the nodes as dim2::Point<int>.
   385     ///
   385     ///
   386     /// Map to get the indices of the nodes as xy<int>.
   386     /// Map to get the indices of the nodes as dim2::Point<int>.
   387     class IndexMap {
   387     class IndexMap {
   388     public:
   388     public:
   389       /// \brief The key type of the map
   389       /// \brief The key type of the map
   390       typedef GridUGraph::Node Key;
   390       typedef GridUGraph::Node Key;
   391       /// \brief The value type of the map
   391       /// \brief The value type of the map
   392       typedef xy<int> Value;
   392       typedef dim2::Point<int> Value;
   393 
   393 
   394       /// \brief Constructor
   394       /// \brief Constructor
   395       ///
   395       ///
   396       /// Constructor
   396       /// Constructor
   397       IndexMap(const GridUGraph& _graph) : graph(_graph) {}
   397       IndexMap(const GridUGraph& _graph) : graph(_graph) {}
   398 
   398 
   399       /// \brief The subscript operator
   399       /// \brief The subscript operator
   400       ///
   400       ///
   401       /// The subscript operator.
   401       /// The subscript operator.
   402       Value operator[](Key key) const {
   402       Value operator[](Key key) const {
   403 	return xy<int>(graph.row(key), graph.col(key));
   403 	return dim2::Point<int>(graph.row(key), graph.col(key));
   404       }
   404       }
   405 
   405 
   406     private:
   406     private:
   407       const GridUGraph& graph;
   407       const GridUGraph& graph;
   408     };
   408     };