doc/maps.dox
changeset 276 b38f4cfa76cf
parent 210 6bc65a8a99c6
child 289 98adf9276de0
equal deleted inserted replaced
3:952358de68b5 4:8d508c34268a
     9 You can find some example below.
     9 You can find some example below.
    10 
    10 
    11 This simple map assigns \f$\pi\f$ to each edge.
    11 This simple map assigns \f$\pi\f$ to each edge.
    12 
    12 
    13 \code
    13 \code
    14 class MyMap 
    14 struct MyMap 
    15 {
    15 {
    16   double operator[](Graph::EdgeIt e) const { return 1;}
    16   typedef double ValueType;
       
    17   double operator[](Graph::EdgeIt e) const { return M_PI;}
    17 };
    18 };
    18 \endcode
    19 \endcode
    19 
    20 
    20 
    21 
    21 Here is a more complex example. It provides a length function which is obtained
    22 Here is a more complex example. It provides a length function which is obtained
    26 class MyLengthMap 
    27 class MyLengthMap 
    27 {
    28 {
    28   const Graph::EdgeMap &ol;
    29   const Graph::EdgeMap &ol;
    29   const Graph::NodeMap &pot;
    30   const Graph::NodeMap &pot;
    30   
    31   
       
    32 public:
       
    33   typedef double ValueType;
       
    34 
    31   double operator[](Graph::EdgeIt e) const {
    35   double operator[](Graph::EdgeIt e) const {
    32     return ol.get(e)-pot.get(v)-pot.get(u);
    36     return ol.get(e)-pot.get(v)-pot.get(u);
    33   }
    37   }
    34   
    38   
    35   MyComplexMap(const Graph::EdgeMap &o,const Graph::NodeMap &p) :
    39   MyComplexMap(const Graph::EdgeMap &o,const Graph::NodeMap &p) :
    36     ol(o), pot(p);
    40     ol(o), pot(p);
    37 };
    41 };
    38 \endcode
    42 \endcode
    39 
    43 
       
    44 \todo Don't we need \e to \e require a 'typedef xxx KeyType' tag, as well?
    40 */
    45 */