COIN-OR::LEMON - Graph Library

source: lemon-0.x/doc/maps.dox @ 206:47f62d789fe7

Last change on this file since 206:47f62d789fe7 was 205:992aac9c9541, checked in by Alpar Juttner, 21 years ago

.

File size: 762 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 get(Graph::EdgeIt e) const { return M_PI;}
17};
18\endcode
19
20Or if we accept the new map style, it will look like this:
21
22\code
23class MyMap
24{
25  double operator[](Graph::EdgeIt e) const { return 1;}
26};
27\endcode
28
29
30A more complex example
31
32\code
33class 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*/
Note: See TracBrowser for help on using the repository browser.