COIN-OR::LEMON - Graph Library

source: lemon-0.x/doc/maps.dox @ 205:992aac9c9541

Last change on this file since 205:992aac9c9541 was 205:992aac9c9541, checked in by Alpar Juttner, 18 years ago

.

File size: 762 bytes
RevLine 
[202]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
[204]11This simple map assigns \f$\pi\f$ to each edge.
12
[202]13\code
14class MyMap
15{
[205]16  double get(Graph::EdgeIt e) const { return M_PI;}
[202]17};
18\endcode
19
[204]20Or if we accept the new map style, it will look like this:
21
22\code
23class MyMap
24{
[205]25  double operator[](Graph::EdgeIt e) const { return 1;}
[204]26};
27\endcode
28
29
[202]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.