Doc improvements
authoralpar
Sun, 16 Jan 2005 22:29:28 +0000
changeset 10838043b93e5973
parent 1082 e9eae612f01c
child 1084 320a0f083ca1
Doc improvements
doc/coding_style.dox
doc/maps.dox
src/lemon/xy.h
     1.1 --- a/doc/coding_style.dox	Sun Jan 16 22:27:34 2005 +0000
     1.2 +++ b/doc/coding_style.dox	Sun Jan 16 22:29:28 2005 +0000
     1.3 @@ -24,7 +24,7 @@
     1.4  header_file.h
     1.5  \endcode
     1.6  
     1.7 -Note that all standard Lemon headers are located in the \c lemon subdirectory,
     1.8 +Note that all standard LEMON headers are located in the \c lemon subdirectory,
     1.9  so you should include them from C++ source like this:
    1.10  
    1.11  \code
    1.12 @@ -79,7 +79,7 @@
    1.13  
    1.14  \section header-template Template Header File
    1.15  
    1.16 -Each Lemon header file should look like this:
    1.17 +Each LEMON header file should look like this:
    1.18  
    1.19  \include template.h
    1.20  
     2.1 --- a/doc/maps.dox	Sun Jan 16 22:27:34 2005 +0000
     2.2 +++ b/doc/maps.dox	Sun Jan 16 22:29:28 2005 +0000
     2.3 @@ -1,7 +1,6 @@
     2.4 +namespace lemon{
     2.5  /*!
     2.6  
     2.7 -
     2.8 -
     2.9  \page maps-page Maps
    2.10  
    2.11  Maps play central role in LEMON. As their name suggests, they map a
    2.12 @@ -13,9 +12,12 @@
    2.13    typedef double Value;
    2.14  \endcode
    2.15  
    2.16 -A map can \e readable (ReadMap, for short), \e writable (WriteMap) or both
    2.17 -(ReadWrite Map). There also exists a special type of
    2.18 -ReadWrite map called <em>reference map</em>. In addition that you can
    2.19 +A map can \e readable (\ref lemon::concept::ReadMap "ReadMap", for short),
    2.20 +\e writable (\ref lemon::concept::WriteMap "WriteMap") or both
    2.21 +(\ref lemon::concept::ReadWriteMap "ReadWriteMap").
    2.22 +There also exists a special type of
    2.23 +ReadWrite map called \ref lemon::concept::ReferenceMap "reference map".
    2.24 +In addition that you can
    2.25  read and write the values of a key, a reference map
    2.26  can also give you a reference to the
    2.27  value belonging to a key, so you have a direct access to the memory address
    2.28 @@ -28,11 +30,12 @@
    2.29  \code
    2.30    ListGraph G;
    2.31  \endcode
    2.32 -and you want to assign floating point value to each edge, you can do
    2.33 +and you want to assign a floating point value to each edge, you can do
    2.34  it like this.
    2.35  \code
    2.36    ListGraph::EdgeMap<double> length(G);
    2.37  \endcode
    2.38 +Note that you must give the underlying graph to the constructor.
    2.39  
    2.40  The value of a readable map can be obtained by <tt>operator[]</tt>.
    2.41  \code
    2.42 @@ -41,7 +44,7 @@
    2.43  where \c e is an instance of \c ListGraph::Edge.
    2.44  (Or anything else
    2.45  that converts to \c ListGraph::Edge, like  \c ListGraph::EdgeIt or
    2.46 -\c ListGraph::OutEdgeIt)
    2.47 +\c ListGraph::OutEdgeIt etc.)
    2.48  
    2.49  There are two ways the assign a new value to a key
    2.50  
    2.51 @@ -60,14 +63,14 @@
    2.52  
    2.53  The first case is more comfortable and if you store complex structures in your
    2.54  map, it might be more efficient. However, there are writable but
    2.55 -not reference maps, so if you want to write an generic algorithm, you should
    2.56 -insist on the second method.
    2.57 +not reference maps, so if you want to write a generic algorithm, you should
    2.58 +insist on the second way.
    2.59  
    2.60  \section how-to-write-your-own-map How to Write Your Own Maps
    2.61  
    2.62  \subsection read-maps Readable Maps
    2.63  
    2.64 -The readable maps are very frequently used as the input of the
    2.65 +Readable maps are very frequently used as the input of the
    2.66  algorithms.  For this purpose the most straightforward way is the use of the
    2.67  default maps provided by LEMON's graph structures.
    2.68  Very often however, it is more
    2.69 @@ -100,13 +103,13 @@
    2.70  \endcode
    2.71  
    2.72  Here is a bit more complex example.
    2.73 -It provides a length function which is obtained
    2.74 +It provides a length function obtained
    2.75  from a base length function shifted by a potential difference.
    2.76  
    2.77  \code
    2.78 -class MyLengthMap  : public MapBase<Graph::Edge,double>
    2.79 +class ReducedLengthMap  : public MapBase<Graph::Edge,double>
    2.80  {
    2.81 -  const Graph &G;
    2.82 +  const Graph &g;
    2.83    const Graph::EdgeMap<double> &orig_len;
    2.84    const Graph::NodeMap<double> &pot;
    2.85    
    2.86 @@ -115,11 +118,22 @@
    2.87      return orig_len.get(e)-pot.get(G.target(e))-pot.get(G.source(e));
    2.88    }
    2.89    
    2.90 -  MyLengthMap(const Graph &g, const Graph::EdgeMap &o,const Graph::NodeMap &p)
    2.91 +  ReducedLengthMap(const Graph &_g,
    2.92 +                   const Graph::EdgeMap &o,
    2.93 +                   const Graph::NodeMap &p)
    2.94      : G(g), orig_len(o), pot(p) {};
    2.95  };
    2.96  \endcode
    2.97  
    2.98 +Then, you can call e.g. Dijkstra algoritm on this map like this:
    2.99 +\code
   2.100 +  ...
   2.101 +  ReducedLengthMap rm(g,len,pot);
   2.102 +  Dijkstra<Graph,ReducedLengthMap> dij(g,rm);
   2.103 +  dij.run(s);
   2.104 +  ...
   2.105 +\endcode
   2.106 +
   2.107  
   2.108  \subsection write-maps Writable Maps
   2.109  
   2.110 @@ -130,3 +144,4 @@
   2.111  To be written...
   2.112  
   2.113  */
   2.114 +}
   2.115 \ No newline at end of file
     3.1 --- a/src/lemon/xy.h	Sun Jan 16 22:27:34 2005 +0000
     3.2 +++ b/src/lemon/xy.h	Sun Jan 16 22:29:28 2005 +0000
     3.3 @@ -146,6 +146,9 @@
     3.4      };
     3.5  
     3.6    ///Returns a vector multiplied by a scalar
     3.7 +
     3.8 +  ///Returns a vector multiplied by a scalar
     3.9 +  ///\relates xy
    3.10    template<typename T> xy<T> operator*(const T &u,const xy<T> &x) {
    3.11      return x*u;
    3.12    };