3 \page maps How to write your own maps
 
     5 \section read-maps Readable Maps
 
     7 The readable maps are very frequently used as the input of the
 
     8 algorithms.  For this purpose the most straightforward is to use the
 
     9 maps provided by Hugo's graph structres. Very often however, it is more
 
    10 convenient and/or more efficient to write your own readable map.
 
    12 You can find some example below.
 
    14 This simple map assigns \f$\pi\f$ to each edge.
 
    19   typedef double ValueType;
 
    20   double operator[](Graph::Edge e) const { return M_PI;}
 
    24 An alternative way to define maps. For this, \c MapBase seems to
 
    25 be a better name then \c NullMap
 
    28 struct MyMap : public MapBase<Edge,double>
 
    30   double operator[](Graph::Edge e) const { return M_PI;}
 
    34 Or, if we had \c KeyType and \c ValueType
 
    37 struct MyMap : public MapBase<Edge,double>
 
    39   ValueType operator[](KeyType e) const { return M_PI;}
 
    44 Here is a more complex example. It provides a length function which is obtained
 
    45 from a base length function modified by a potential difference.
 
    50   const Graph::EdgeMap &ol;
 
    51   const Graph::NodeMap &pot;
 
    54   typedef double ValueType;
 
    56   double operator[](Graph::Edge e) const {
 
    57     return ol.get(e)-pot.get(v)-pot.get(u);
 
    60   MyComplexMap(const Graph::EdgeMap &o,const Graph::NodeMap &p) :
 
    65 \todo Please improve on the english. 
 
    66 \todo Don't we need \e to \e require a 'typedef xxx KeyType' tag, as well?