doc/maps.dox
author alpar
Fri, 19 Mar 2004 07:58:58 +0000
changeset 204 d8107ae24128
parent 202 0bd4fe53b1d0
child 205 992aac9c9541
permissions -rw-r--r--
.
     1 /*!
     2 
     3 \page maps How to write maps
     4 
     5 \section read-maps Readable Maps
     6 
     7 It is quite easy to write your own readmap for the edges or nodes of a graph.
     8 
     9 You can find some example below.
    10 
    11 This simple map assigns \f$\pi\f$ to each edge.
    12 
    13 \code
    14 class MyMap 
    15 {
    16   double get(Graph::EdgeIt e) { return M_PI;}
    17 };
    18 \endcode
    19 
    20 Or if we accept the new map style, it will look like this:
    21 
    22 \code
    23 class MyMap 
    24 {
    25   double operator[](Graph::EdgeIt e) { return 1;}
    26 };
    27 \endcode
    28 
    29 
    30 A more complex example
    31 
    32 \code
    33 class MyLengthMap 
    34 {
    35   const Graph::EdgeMap &ol;
    36   const Graph::NodeMap &pot;
    37   
    38   double get(Graph::EdgeIt e) const { return ol.get(e)-pot.get(v)-pot.get(u);}
    39   
    40   MyComplexMap(const Graph::EdgeMap &o,const Graph::NodeMap &p) :
    41     ol(o), pot(p);
    42 };
    43 \endcode
    44 
    45 */