Rev | Line | |
---|
[202] | 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 | |
---|
[204] | 11 | This simple map assigns \f$\pi\f$ to each edge. |
---|
| 12 | |
---|
[202] | 13 | \code |
---|
| 14 | class MyMap |
---|
| 15 | { |
---|
[205] | 16 | double operator[](Graph::EdgeIt e) const { return 1;} |
---|
[204] | 17 | }; |
---|
| 18 | \endcode |
---|
| 19 | |
---|
| 20 | |
---|
[210] | 21 | Here is a more complex example. It provides a length function which is obtained |
---|
| 22 | from a base length function modified by a potential difference. |
---|
| 23 | \todo Please improve on the english. |
---|
[202] | 24 | |
---|
| 25 | \code |
---|
| 26 | class MyLengthMap |
---|
| 27 | { |
---|
| 28 | const Graph::EdgeMap &ol; |
---|
| 29 | const Graph::NodeMap &pot; |
---|
| 30 | |
---|
[210] | 31 | double operator[](Graph::EdgeIt e) const { |
---|
| 32 | return ol.get(e)-pot.get(v)-pot.get(u); |
---|
| 33 | } |
---|
[202] | 34 | |
---|
| 35 | MyComplexMap(const Graph::EdgeMap &o,const Graph::NodeMap &p) : |
---|
| 36 | ol(o), pot(p); |
---|
| 37 | }; |
---|
| 38 | \endcode |
---|
| 39 | |
---|
| 40 | */ |
---|
Note: See
TracBrowser
for help on using the repository browser.