| Line | |
|---|
| 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 | struct MyMap |
|---|
| 15 | { |
|---|
| 16 | typedef double ValueType; |
|---|
| 17 | double operator[](Graph::EdgeIt e) const { return M_PI;} |
|---|
| 18 | }; |
|---|
| 19 | \endcode |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | Here is a more complex example. It provides a length function which is obtained |
|---|
| 23 | from a base length function modified by a potential difference. |
|---|
| 24 | \todo Please improve on the english. |
|---|
| 25 | |
|---|
| 26 | \code |
|---|
| 27 | class MyLengthMap |
|---|
| 28 | { |
|---|
| 29 | const Graph::EdgeMap &ol; |
|---|
| 30 | const Graph::NodeMap &pot; |
|---|
| 31 | |
|---|
| 32 | public: |
|---|
| 33 | typedef double ValueType; |
|---|
| 34 | |
|---|
| 35 | double operator[](Graph::EdgeIt e) const { |
|---|
| 36 | return ol.get(e)-pot.get(v)-pot.get(u); |
|---|
| 37 | } |
|---|
| 38 | |
|---|
| 39 | MyComplexMap(const Graph::EdgeMap &o,const Graph::NodeMap &p) : |
|---|
| 40 | ol(o), pot(p); |
|---|
| 41 | }; |
|---|
| 42 | \endcode |
|---|
| 43 | |
|---|
| 44 | \todo Don't we need \e to \e require a 'typedef xxx KeyType' tag, as well? |
|---|
| 45 | */ |
|---|
Note: See
TracBrowser
for help on using the repository browser.