[Lemon-commits] [lemon_svn] jacint: r1698 - in hugo/trunk/src/lemon: . concept
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:47:04 CET 2006
Author: jacint
Date: Tue Mar 29 09:35:09 2005
New Revision: 1698
Modified:
hugo/trunk/src/lemon/bfs.h
hugo/trunk/src/lemon/bin_heap.h
hugo/trunk/src/lemon/concept/path.h
hugo/trunk/src/lemon/fib_heap.h
hugo/trunk/src/lemon/min_cost_flow.h
hugo/trunk/src/lemon/utility.h
Log:
bugfixes in doc
Modified: hugo/trunk/src/lemon/bfs.h
==============================================================================
--- hugo/trunk/src/lemon/bfs.h (original)
+++ hugo/trunk/src/lemon/bfs.h Tue Mar 29 09:35:09 2005
@@ -135,7 +135,7 @@
///See \ref BfsDefaultTraits for the documentation of
///a Bfs traits class.
///
- ///\author Jacint Szabo and Alpar Juttner
+ ///\author Alpar Juttner
///\todo A compare object would be nice.
#ifdef DOXYGEN
@@ -348,7 +348,7 @@
///
///\ref named-templ-param "Named parameter"
///for setting the ProcessedMap type to be Graph::NodeMap<bool>.
- ///If you don't set it explicitely, it will be automatically allocated.
+ ///If you don't set it explicitly, it will be automatically allocated.
template <class T>
class DefProcessedMapToBeDefaultMap :
public Bfs< Graph,
@@ -385,7 +385,7 @@
///Sets the map storing the predecessor edges.
///If you don't use this function before calling \ref run(),
- ///it will allocate one. The destuctor deallocates this
+ ///it will allocate one. The destructor deallocates this
///automatically allocated map, of course.
///\return <tt> (*this) </tt>
Bfs &predMap(PredMap &m)
@@ -402,7 +402,7 @@
///Sets the map indicating the reached nodes.
///If you don't use this function before calling \ref run(),
- ///it will allocate one. The destuctor deallocates this
+ ///it will allocate one. The destructor deallocates this
///automatically allocated map, of course.
///\return <tt> (*this) </tt>
Bfs &reachedMap(ReachedMap &m)
@@ -419,7 +419,7 @@
///Sets the map indicating the processed nodes.
///If you don't use this function before calling \ref run(),
- ///it will allocate one. The destuctor deallocates this
+ ///it will allocate one. The destructor deallocates this
///automatically allocated map, of course.
///\return <tt> (*this) </tt>
Bfs &processedMap(ProcessedMap &m)
@@ -436,7 +436,7 @@
// ///Sets the map storing the predecessor nodes.
// ///If you don't use this function before calling \ref run(),
-// ///it will allocate one. The destuctor deallocates this
+// ///it will allocate one. The destructor deallocates this
// ///automatically allocated map, of course.
// ///\return <tt> (*this) </tt>
// Bfs &predNodeMap(PredNodeMap &m)
@@ -453,7 +453,7 @@
///Sets the map storing the distances calculated by the algorithm.
///If you don't use this function before calling \ref run(),
- ///it will allocate one. The destuctor deallocates this
+ ///it will allocate one. The destructor deallocates this
///automatically allocated map, of course.
///\return <tt> (*this) </tt>
Bfs &distMap(DistMap &m)
@@ -658,7 +658,7 @@
///Returns the distance of a node from the root(s).
///\pre \ref run() must be called before using this function.
///\warning If node \c v in unreachable from the root(s) the return value
- ///of this funcion is undefined.
+ ///of this function is undefined.
int dist(Node v) const { return (*_dist)[v]; }
///Returns the 'previous edge' of the shortest path tree.
@@ -715,7 +715,7 @@
///Checks if a node is reachable from the root.
///Returns \c true if \c v is reachable from the root.
- ///\warning The source nodes are inditated as unreached.
+ ///\warning The source nodes are indicated as unreached.
///\pre Either \ref run() or \ref start()
///must be called before using this function.
///
Modified: hugo/trunk/src/lemon/bin_heap.h
==============================================================================
--- hugo/trunk/src/lemon/bin_heap.h (original)
+++ hugo/trunk/src/lemon/bin_heap.h Tue Mar 29 09:35:09 2005
@@ -20,7 +20,6 @@
///\ingroup auxdat
///\file
///\brief Binary Heap implementation.
-///\todo It should be documented.
#include <vector>
#include <utility>
@@ -31,9 +30,20 @@
/// \addtogroup auxdat
/// @{
- /// A Binary Heap implementation.
+ /// A Binary Heap implementation.
- ///\todo Please document...
+ ///This class implements the \e binary \e heap data structure. A \e heap
+ ///is a data structure for storing items with specified values called \e
+ ///priorities in such a way that finding the item with minimum priority is
+ ///efficient. \c Compare specifies the ordering of the priorities. In a heap
+ ///one can change the priority of an item, add or erase an item, etc.
+ ///
+ ///\param Item Type of the items to be stored.
+ ///\param Prio Type of the priority of the items.
+ ///\param ItemIntMap A read and writable Item int map, used internally
+ ///to handle the cross references.
+ ///\param Compare A class for the ordering of the priorities. The
+ ///default is \c std::less<Prio>.
///
///\sa FibHeap
///\sa Dijkstra
@@ -72,16 +82,37 @@
ItemIntMap &iim;
public:
- ///\e
+ ///The constructor
+
+ /**
+ \c _iim should be given to the constructor, since it is used
+ internally to handle the cross references.
+ */
explicit BinHeap(ItemIntMap &_iim) : iim(_iim) {}
- ///\e
+
+ ///The constructor
+
+ /**
+ \c _iim should be given to the constructor, since it is used
+ internally to handle the cross references. \c _comp is an
+ object for ordering of the priorities.
+ */
BinHeap(ItemIntMap &_iim, const Compare &_comp)
: iim(_iim), comp(_comp) {}
- ///\e
+ ///The number of items stored in the heap.
+
+ /**
+ Returns the number of items stored in the heap.
+ */
int size() const { return data.size(); }
- ///\e
+
+ ///Checks if the heap stores no items.
+
+ /**
+ Returns \c true if and only if the heap stores no items.
+ */
bool empty() const { return data.empty(); }
private:
@@ -111,41 +142,86 @@
}
public:
- ///\e
+ ///Adds \c p.first to the heap with priority \c p.second.
+
+ /**
+ Adds \c p.first to the heap with priority \c p.second.
+ \c p.first must not be stored in the heap.
+ */
void push(const PairType &p) {
int n = data.size();
data.resize(n+1);
bubble_up(n, p);
}
- ///\e
+
+ ///Adds \c i to the heap with priority \c p.
+
+ /**
+ Adds \c i to the heap with priority \c p.
+ \pre \c i must not be stored in the heap.
+ */
void push(const Item &i, const Prio &p) { push(PairType(i,p)); }
- ///\e
+ ///Returns the item with minimum priority relative to \c Compare.
+
+ /**
+ This method returns the item with minimum priority relative to \c
+ Compare.
+ \pre The heap must be nonempty.
+ */
Item top() const {
return data[0].first;
}
- /// Returns the prio of the top element of the heap.
+
+ ///Returns the minimum priority relative to \c Compare.
+
+ /**
+ It returns the minimum priority relative to \c Compare.
+ \pre The heap must be nonempty.
+ */
Prio prio() const {
return data[0].second;
}
- ///\e
+ ///Deletes the item with minimum priority relative to \c Compare.
+
+ /**
+ This method deletes the item with minimum priority relative to \c
+ Compare from the heap.
+ \pre The heap must be non-empty.
+ */
void pop() {
rmidx(0);
}
- ///\e
+ ///Deletes \c i from the heap.
+
+ /**
+ This method deletes item \c i from the heap, if \c i was
+ already stored in the heap.
+ */
void erase(const Item &i) {
rmidx(iim[i]);
}
- ///\e
+
+ ///Returns the priority of \c i.
+
+ /**
+ This function returns the priority of item \c i.
+ \pre \c i must be in the heap.
+ */
Prio operator[](const Item &i) const {
int idx = iim[i];
return data[idx].second;
}
- ///\e
+ ///\c i gets to the heap with priority \c p independently if \c i was already there.
+
+ /**
+ This method calls \ref push(\c i, \c p) if \c i is not stored
+ in the heap and sets the priority of \c i to \c p otherwise.
+ */
void set(const Item &i, const Prio &p) {
int idx = iim[i];
if( idx < 0 ) {
@@ -159,18 +235,38 @@
}
}
- ///\e
+ ///Decreases the priority of \c i to \c p.
+
+ /**
+ This method decreases the priority of item \c i to \c p.
+ \pre \c i must be stored in the heap with priority at least \c
+ p relative to \c Compare.
+ */
void decrease(const Item &i, const Prio &p) {
int idx = iim[i];
bubble_up(idx, PairType(i,p));
}
- ///\e
+
+ ///Increases the priority of \c i to \c p.
+
+ /**
+ This method sets the priority of item \c i to \c p.
+ \pre \c i must be stored in the heap with priority at most \c
+ p relative to \c Compare.
+ */
void increase(const Item &i, const Prio &p) {
int idx = iim[i];
bubble_down(idx, PairType(i,p), data.size());
}
- ///\e
+ ///Returns if \c item is in, has already been in, or has never been in the heap.
+
+ /**
+ This method returns PRE_HEAP if \c item has never been in the
+ heap, IN_HEAP if it is in the heap at the moment, and POST_HEAP
+ otherwise. In the latter case it is possible that \c item will
+ get back to the heap again.
+ */
state_enum state(const Item &i) const {
int s = iim[i];
if( s>=0 )
Modified: hugo/trunk/src/lemon/concept/path.h
==============================================================================
--- hugo/trunk/src/lemon/concept/path.h (original)
+++ hugo/trunk/src/lemon/concept/path.h Tue Mar 29 09:35:09 2005
@@ -36,7 +36,7 @@
//! A skeleton structure for representing directed paths in a graph.
//! \param GR The graph type in which the path is.
//!
- //! In a sense, the path can be treated as a graph, for is has \c NodeIt
+ //! In a sense, the path can be treated as a graph, for it has \c NodeIt
//! and \c EdgeIt with the same usage. These types converts to the \c Node
//! and \c Edge of the original graph.
template<typename GR>
@@ -172,9 +172,9 @@
* arbitrary order then you should commit these changes to the graph.
*
* While the builder is active (after the first modifying
- * operation and until the call of \ref commit())
- * the underlining Path is in a
- * "transitional" state (operations on it have undefined result).
+ * operation and until the call of \ref commit()) the
+ * underlining Path is in a "transitional" state (operations on
+ * it have undefined result).
*/
class Builder {
public:
@@ -190,7 +190,7 @@
/// Sets the starting node of the path. Edge added to the path
/// afterwards have to be incident to this node.
- /// You \em must start building an empry path with this functions.
+ /// You \em must start building an empty path with these functions.
/// (And you \em must \em not use it later).
/// \sa pushFront()
/// \sa pushBack()
@@ -215,13 +215,13 @@
///Reserve (front) storage for the builder in advance.
- ///If you know an reasonable upper bound of the number of the edges
+ ///If you know a reasonable upper bound on the number of the edges
///to add to the front of the path,
///using this function you may speed up the building.
void reserveFront(size_t r) {}
///Reserve (back) storage for the builder in advance.
- ///If you know an reasonable upper bound of the number of the edges
+ ///If you know a reasonable upper bound on the number of the edges
///to add to the back of the path,
///using this function you may speed up the building.
void reserveBack(size_t r) {}
Modified: hugo/trunk/src/lemon/fib_heap.h
==============================================================================
--- hugo/trunk/src/lemon/fib_heap.h (original)
+++ hugo/trunk/src/lemon/fib_heap.h Tue Mar 29 09:35:09 2005
@@ -88,10 +88,24 @@
POST_HEAP = -2
};
+ ///The constructor
+
+ /**
+ \c _iimap should be given to the constructor, since it is
+ used internally to handle the cross references.
+ */
explicit FibHeap(ItemIntMap &_iimap)
: minimum(0), iimap(_iimap), num_items() {}
+
+ ///The constructor
+
+ /**
+ \c _iimap should be given to the constructor, since it is used
+ internally to handle the cross references. \c _comp is an
+ object for ordering of the priorities.
+ */
FibHeap(ItemIntMap &_iimap, const Compare &_comp) : minimum(0),
- iimap(_iimap), comp(_comp), num_items() {}
+ iimap(_iimap), comp(_comp), num_items() {}
///The number of items stored in the heap.
Modified: hugo/trunk/src/lemon/min_cost_flow.h
==============================================================================
--- hugo/trunk/src/lemon/min_cost_flow.h (original)
+++ hugo/trunk/src/lemon/min_cost_flow.h Tue Mar 29 09:35:09 2005
@@ -36,20 +36,18 @@
///(for small values of \c k) having minimal total cost between 2 nodes
///
///
- /// The class \ref lemon::MinCostFlow "MinCostFlow" implements
- /// an algorithm for finding a flow of value \c k
- /// having minimal total cost
- /// from a given source node to a given target node in an
- /// edge-weighted directed graph. To this end,
- /// the edge-capacities and edge-weitghs have to be nonnegative.
- /// The edge-capacities should be integers, but the edge-weights can be
- /// integers, reals or of other comparable numeric type.
- /// This algorithm is intended to use only for small values of \c k,
- /// since it is only polynomial in k,
- /// not in the length of k (which is log k).
- /// In order to find the minimum cost flow of value \c k it
- /// finds the minimum cost flow of value \c i for every
- /// \c i between 0 and \c k.
+ /// The class \ref lemon::MinCostFlow "MinCostFlow" implements an
+ /// algorithm for finding a flow of value \c k having minimal total
+ /// cost from a given source node to a given target node in an
+ /// edge-weighted directed graph. To this end, the edge-capacities
+ /// and edge-weights have to be nonnegative. The edge-capacities
+ /// should be integers, but the edge-weights can be integers, reals
+ /// or of other comparable numeric type. This algorithm is intended
+ /// to be used only for small values of \c k, since it is only
+ /// polynomial in k, not in the length of k (which is log k): in
+ /// order to find the minimum cost flow of value \c k it finds the
+ /// minimum cost flow of value \c i for every \c i between 0 and \c
+ /// k.
///
///\param Graph The directed graph type the algorithm runs on.
///\param LengthMap The type of the length map.
@@ -149,7 +147,7 @@
for(typename ResGW::NodeIt n(res_graph); n!=INVALID; ++n)
potential.set(n, potential[n]+dijkstra.distMap()[n]);
- //Augmenting on the sortest path
+ //Augmenting on the shortest path
Node n=t;
ResGraphEdge e;
while (n!=s){
@@ -226,7 +224,7 @@
/*! \brief Checking the complementary slackness optimality criteria.
This function checks, whether the given flow and potential
- satisfiy the complementary slackness cnditions (i.e. these are optimal).
+ satisfy the complementary slackness conditions (i.e. these are optimal).
This function only checks optimality, doesn't bother with feasibility.
For testing purpose.
*/
Modified: hugo/trunk/src/lemon/utility.h
==============================================================================
--- hugo/trunk/src/lemon/utility.h (original)
+++ hugo/trunk/src/lemon/utility.h Tue Mar 29 09:35:09 2005
@@ -37,7 +37,7 @@
namespace lemon
{
- /// Basic type for defining "tags". A "YES" condidion for enable_if.
+ /// Basic type for defining "tags". A "YES" condition for enable_if.
/// \todo This should go to a separate "basic_types.h" (or something)
/// file.
@@ -45,7 +45,7 @@
static const bool value = true;
};
- /// Basic type for defining "tags". A "NO" condidion for enable_if.
+ /// Basic type for defining "tags". A "NO" condition for enable_if.
struct False {
static const bool value = false;
};
More information about the Lemon-commits
mailing list