[Lemon-commits] [lemon_svn] alpar: r1479 - in hugo/trunk: doc src/lemon

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:45:46 CET 2006


Author: alpar
Date: Sun Jan 16 23:29:28 2005
New Revision: 1479

Modified:
   hugo/trunk/doc/coding_style.dox
   hugo/trunk/doc/maps.dox
   hugo/trunk/src/lemon/xy.h

Log:
Doc improvements

Modified: hugo/trunk/doc/coding_style.dox
==============================================================================
--- hugo/trunk/doc/coding_style.dox	(original)
+++ hugo/trunk/doc/coding_style.dox	Sun Jan 16 23:29:28 2005
@@ -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
 

Modified: hugo/trunk/doc/maps.dox
==============================================================================
--- hugo/trunk/doc/maps.dox	(original)
+++ hugo/trunk/doc/maps.dox	Sun Jan 16 23:29:28 2005
@@ -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 <em>reference map</em>. 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<double> length(G);
 \endcode
+Note that you must give the underlying graph to the constructor.
 
 The value of a readable map can be obtained by <tt>operator[]</tt>.
 \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<Graph::Edge,double>
+class ReducedLengthMap  : public MapBase<Graph::Edge,double>
 {
-  const Graph &G;
+  const Graph &g;
   const Graph::EdgeMap<double> &orig_len;
   const Graph::NodeMap<double> &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<Graph,ReducedLengthMap> 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

Modified: hugo/trunk/src/lemon/xy.h
==============================================================================
--- hugo/trunk/src/lemon/xy.h	(original)
+++ hugo/trunk/src/lemon/xy.h	Sun Jan 16 23:29:28 2005
@@ -146,6 +146,9 @@
     };
 
   ///Returns a vector multiplied by a scalar
+
+  ///Returns a vector multiplied by a scalar
+  ///\relates xy
   template<typename T> xy<T> operator*(const T &u,const xy<T> &x) {
     return x*u;
   };



More information about the Lemon-commits mailing list