doc/maps.dox
author marci
Fri, 19 Mar 2004 09:09:20 +0000
changeset 206 47f62d789fe7
parent 204 d8107ae24128
child 210 6bc65a8a99c6
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) const { 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) const { 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 */