doc/maps.dox
author alpar
Sun, 21 Mar 2004 14:59:51 +0000
changeset 224 5bc1c83257f8
parent 205 992aac9c9541
child 273 e9024dad7fc1
permissions -rw-r--r--
Some doc added
alpar@202
     1
/*!
alpar@202
     2
alpar@202
     3
\page maps How to write maps
alpar@202
     4
alpar@202
     5
\section read-maps Readable Maps
alpar@202
     6
alpar@202
     7
It is quite easy to write your own readmap for the edges or nodes of a graph.
alpar@202
     8
alpar@202
     9
You can find some example below.
alpar@202
    10
alpar@204
    11
This simple map assigns \f$\pi\f$ to each edge.
alpar@204
    12
alpar@202
    13
\code
alpar@202
    14
class MyMap 
alpar@202
    15
{
alpar@205
    16
  double operator[](Graph::EdgeIt e) const { return 1;}
alpar@204
    17
};
alpar@204
    18
\endcode
alpar@204
    19
alpar@204
    20
alpar@210
    21
Here is a more complex example. It provides a length function which is obtained
alpar@210
    22
from a base length function modified by a potential difference.
alpar@210
    23
\todo Please improve on the english. 
alpar@202
    24
alpar@202
    25
\code
alpar@202
    26
class MyLengthMap 
alpar@202
    27
{
alpar@202
    28
  const Graph::EdgeMap &ol;
alpar@202
    29
  const Graph::NodeMap &pot;
alpar@202
    30
  
alpar@210
    31
  double operator[](Graph::EdgeIt e) const {
alpar@210
    32
    return ol.get(e)-pot.get(v)-pot.get(u);
alpar@210
    33
  }
alpar@202
    34
  
alpar@202
    35
  MyComplexMap(const Graph::EdgeMap &o,const Graph::NodeMap &p) :
alpar@202
    36
    ol(o), pot(p);
alpar@202
    37
};
alpar@202
    38
\endcode
alpar@202
    39
alpar@202
    40
*/