# HG changeset patch # User alpar # Date 1105914568 0 # Node ID 8043b93e5973f884b7429ddb27f71a0ef274337b # Parent e9eae612f01ca7270d38ae9bf1fa3759bd388295 Doc improvements diff -r e9eae612f01c -r 8043b93e5973 doc/coding_style.dox --- a/doc/coding_style.dox Sun Jan 16 22:27:34 2005 +0000 +++ b/doc/coding_style.dox Sun Jan 16 22:29:28 2005 +0000 @@ -24,7 +24,7 @@ header_file.h \endcode -Note that all standard Lemon headers are located in the \c lemon subdirectory, +Note that all standard LEMON headers are located in the \c lemon subdirectory, so you should include them from C++ source like this: \code @@ -79,7 +79,7 @@ \section header-template Template Header File -Each Lemon header file should look like this: +Each LEMON header file should look like this: \include template.h diff -r e9eae612f01c -r 8043b93e5973 doc/maps.dox --- a/doc/maps.dox Sun Jan 16 22:27:34 2005 +0000 +++ b/doc/maps.dox Sun Jan 16 22:29:28 2005 +0000 @@ -1,7 +1,6 @@ +namespace lemon{ /*! - - \page maps-page Maps Maps play central role in LEMON. As their name suggests, they map a @@ -13,9 +12,12 @@ typedef double Value; \endcode -A map can \e readable (ReadMap, for short), \e writable (WriteMap) or both -(ReadWrite Map). There also exists a special type of -ReadWrite map called reference map. In addition that you can +A map can \e readable (\ref lemon::concept::ReadMap "ReadMap", for short), +\e writable (\ref lemon::concept::WriteMap "WriteMap") or both +(\ref lemon::concept::ReadWriteMap "ReadWriteMap"). +There also exists a special type of +ReadWrite map called \ref lemon::concept::ReferenceMap "reference map". +In addition that you can read and write the values of a key, a reference map can also give you a reference to the value belonging to a key, so you have a direct access to the memory address @@ -28,11 +30,12 @@ \code ListGraph G; \endcode -and you want to assign floating point value to each edge, you can do +and you want to assign a floating point value to each edge, you can do it like this. \code ListGraph::EdgeMap length(G); \endcode +Note that you must give the underlying graph to the constructor. The value of a readable map can be obtained by operator[]. \code @@ -41,7 +44,7 @@ where \c e is an instance of \c ListGraph::Edge. (Or anything else that converts to \c ListGraph::Edge, like \c ListGraph::EdgeIt or -\c ListGraph::OutEdgeIt) +\c ListGraph::OutEdgeIt etc.) There are two ways the assign a new value to a key @@ -60,14 +63,14 @@ The first case is more comfortable and if you store complex structures in your map, it might be more efficient. However, there are writable but -not reference maps, so if you want to write an generic algorithm, you should -insist on the second method. +not reference maps, so if you want to write a generic algorithm, you should +insist on the second way. \section how-to-write-your-own-map How to Write Your Own Maps \subsection read-maps Readable Maps -The readable maps are very frequently used as the input of the +Readable maps are very frequently used as the input of the algorithms. For this purpose the most straightforward way is the use of the default maps provided by LEMON's graph structures. Very often however, it is more @@ -100,13 +103,13 @@ \endcode Here is a bit more complex example. -It provides a length function which is obtained +It provides a length function obtained from a base length function shifted by a potential difference. \code -class MyLengthMap : public MapBase +class ReducedLengthMap : public MapBase { - const Graph &G; + const Graph &g; const Graph::EdgeMap &orig_len; const Graph::NodeMap &pot; @@ -115,11 +118,22 @@ return orig_len.get(e)-pot.get(G.target(e))-pot.get(G.source(e)); } - MyLengthMap(const Graph &g, const Graph::EdgeMap &o,const Graph::NodeMap &p) + ReducedLengthMap(const Graph &_g, + const Graph::EdgeMap &o, + const Graph::NodeMap &p) : G(g), orig_len(o), pot(p) {}; }; \endcode +Then, you can call e.g. Dijkstra algoritm on this map like this: +\code + ... + ReducedLengthMap rm(g,len,pot); + Dijkstra dij(g,rm); + dij.run(s); + ... +\endcode + \subsection write-maps Writable Maps @@ -130,3 +144,4 @@ To be written... */ +} \ No newline at end of file diff -r e9eae612f01c -r 8043b93e5973 src/lemon/xy.h --- a/src/lemon/xy.h Sun Jan 16 22:27:34 2005 +0000 +++ b/src/lemon/xy.h Sun Jan 16 22:29:28 2005 +0000 @@ -146,6 +146,9 @@ }; ///Returns a vector multiplied by a scalar + + ///Returns a vector multiplied by a scalar + ///\relates xy template xy operator*(const T &u,const xy &x) { return x*u; };