COIN-OR::LEMON - Graph Library

Changeset 1083:8043b93e5973 in lemon-0.x for doc


Ignore:
Timestamp:
01/16/05 23:29:28 (15 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1479
Message:

Doc improvements

Location:
doc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • doc/coding_style.dox

    r991 r1083  
    2525\endcode
    2626
    27 Note that all standard Lemon headers are located in the \c lemon subdirectory,
     27Note that all standard LEMON headers are located in the \c lemon subdirectory,
    2828so you should include them from C++ source like this:
    2929
     
    8080\section header-template Template Header File
    8181
    82 Each Lemon header file should look like this:
     82Each LEMON header file should look like this:
    8383
    8484\include template.h
  • doc/maps.dox

    r1043 r1083  
     1namespace lemon{
    12/*!
    2 
    3 
    43
    54\page maps-page Maps
     
    1413\endcode
    1514
    16 A map can \e readable (ReadMap, for short), \e writable (WriteMap) or both
    17 (ReadWrite Map). There also exists a special type of
    18 ReadWrite map called <em>reference map</em>. In addition that you can
     15A map can \e readable (\ref lemon::concept::ReadMap "ReadMap", for short),
     16\e writable (\ref lemon::concept::WriteMap "WriteMap") or both
     17(\ref lemon::concept::ReadWriteMap "ReadWriteMap").
     18There also exists a special type of
     19ReadWrite map called \ref lemon::concept::ReferenceMap "reference map".
     20In addition that you can
    1921read and write the values of a key, a reference map
    2022can also give you a reference to the
     
    2931  ListGraph G;
    3032\endcode
    31 and you want to assign floating point value to each edge, you can do
     33and you want to assign a floating point value to each edge, you can do
    3234it like this.
    3335\code
    3436  ListGraph::EdgeMap<double> length(G);
    3537\endcode
     38Note that you must give the underlying graph to the constructor.
    3639
    3740The value of a readable map can be obtained by <tt>operator[]</tt>.
     
    4245(Or anything else
    4346that converts to \c ListGraph::Edge, like  \c ListGraph::EdgeIt or
    44 \c ListGraph::OutEdgeIt)
     47\c ListGraph::OutEdgeIt etc.)
    4548
    4649There are two ways the assign a new value to a key
     
    6164The first case is more comfortable and if you store complex structures in your
    6265map, it might be more efficient. However, there are writable but
    63 not reference maps, so if you want to write an generic algorithm, you should
    64 insist on the second method.
     66not reference maps, so if you want to write a generic algorithm, you should
     67insist on the second way.
    6568
    6669\section how-to-write-your-own-map How to Write Your Own Maps
     
    6871\subsection read-maps Readable Maps
    6972
    70 The readable maps are very frequently used as the input of the
     73Readable maps are very frequently used as the input of the
    7174algorithms.  For this purpose the most straightforward way is the use of the
    7275default maps provided by LEMON's graph structures.
     
    101104
    102105Here is a bit more complex example.
    103 It provides a length function which is obtained
     106It provides a length function obtained
    104107from a base length function shifted by a potential difference.
    105108
    106109\code
    107 class MyLengthMap  : public MapBase<Graph::Edge,double>
     110class ReducedLengthMap  : public MapBase<Graph::Edge,double>
    108111{
    109   const Graph &G;
     112  const Graph &g;
    110113  const Graph::EdgeMap<double> &orig_len;
    111114  const Graph::NodeMap<double> &pot;
     
    116119  }
    117120 
    118   MyLengthMap(const Graph &g, const Graph::EdgeMap &o,const Graph::NodeMap &p)
     121  ReducedLengthMap(const Graph &_g,
     122                   const Graph::EdgeMap &o,
     123                   const Graph::NodeMap &p)
    119124    : G(g), orig_len(o), pot(p) {};
    120125};
     126\endcode
     127
     128Then, you can call e.g. Dijkstra algoritm on this map like this:
     129\code
     130  ...
     131  ReducedLengthMap rm(g,len,pot);
     132  Dijkstra<Graph,ReducedLengthMap> dij(g,rm);
     133  dij.run(s);
     134  ...
    121135\endcode
    122136
     
    131145
    132146*/
     147}
Note: See TracChangeset for help on using the changeset viewer.