COIN-OR::LEMON - Graph Library

source: lemon-0.x/doc/maps.dox @ 263:f24f276e0b6b

Last change on this file since 263:f24f276e0b6b was 210:6bc65a8a99c6, checked in by Alpar Juttner, 20 years ago

get() -> operator[]()

File size: 789 bytes
Line 
1/*!
2
3\page maps How to write maps
4
5\section read-maps Readable Maps
6
7It is quite easy to write your own readmap for the edges or nodes of a graph.
8
9You can find some example below.
10
11This simple map assigns \f$\pi\f$ to each edge.
12
13\code
14class MyMap
15{
16  double operator[](Graph::EdgeIt e) const { return 1;}
17};
18\endcode
19
20
21Here is a more complex example. It provides a length function which is obtained
22from a base length function modified by a potential difference.
23\todo Please improve on the english.
24
25\code
26class MyLengthMap
27{
28  const Graph::EdgeMap &ol;
29  const Graph::NodeMap &pot;
30 
31  double operator[](Graph::EdgeIt e) const {
32    return ol.get(e)-pot.get(v)-pot.get(u);
33  }
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.