[Lemon-commits] Peter Kovacs: Doc improvements and unification f...

Lemon HG hg at lemon.cs.elte.hu
Wed Sep 30 08:52:46 CEST 2009


details:   http://lemon.cs.elte.hu/hg/lemon/rev/bd72f8d20f33
changeset: 785:bd72f8d20f33
user:      Peter Kovacs <kpeter [at] inf.elte.hu>
date:      Sun Aug 23 11:07:50 2009 +0200
description:
	Doc improvements and unification for graph concepts (#311)

diffstat:

 lemon/concepts/digraph.h          |  335 ++++++++++----------
 lemon/concepts/graph.h            |  656 +++++++++++++++++++++-------------------
 lemon/concepts/graph_components.h |    2 +-
 3 files changed, 507 insertions(+), 486 deletions(-)

diffs (truncated from 1612 to 300 lines):

diff --git a/lemon/concepts/digraph.h b/lemon/concepts/digraph.h
--- a/lemon/concepts/digraph.h
+++ b/lemon/concepts/digraph.h
@@ -35,46 +35,40 @@
     ///
     /// \brief Class describing the concept of directed graphs.
     ///
-    /// This class describes the \ref concept "concept" of the
-    /// immutable directed digraphs.
+    /// This class describes the common interface of all directed
+    /// graphs (digraphs).
     ///
-    /// Note that actual digraph implementation like @ref ListDigraph or
-    /// @ref SmartDigraph may have several additional functionality.
+    /// Like all concept classes, it only provides an interface
+    /// without any sensible implementation. So any general algorithm for
+    /// directed graphs should compile with this class, but it will not
+    /// run properly, of course.
+    /// An actual digraph implementation like \ref ListDigraph or
+    /// \ref SmartDigraph may have additional functionality.
     ///
-    /// \sa concept
+    /// \sa Graph
     class Digraph {
     private:
-      ///Digraphs are \e not copy constructible. Use DigraphCopy() instead.
+      /// Diraphs are \e not copy constructible. Use DigraphCopy instead.
+      Digraph(const Digraph &) {}
+      /// \brief Assignment of a digraph to another one is \e not allowed.
+      /// Use DigraphCopy instead.
+      void operator=(const Digraph &) {}
 
-      ///Digraphs are \e not copy constructible. Use DigraphCopy() instead.
-      ///
-      Digraph(const Digraph &) {};
-      ///\brief Assignment of \ref Digraph "Digraph"s to another ones are
-      ///\e not allowed. Use DigraphCopy() instead.
+    public:
+      /// Default constructor.
+      Digraph() { }
 
-      ///Assignment of \ref Digraph "Digraph"s to another ones are
-      ///\e not allowed.  Use DigraphCopy() instead.
-
-      void operator=(const Digraph &) {}
-    public:
-      ///\e
-
-      /// Defalult constructor.
-
-      /// Defalult constructor.
-      ///
-      Digraph() { }
-      /// Class for identifying a node of the digraph
+      /// The node type of the digraph
 
       /// This class identifies a node of the digraph. It also serves
       /// as a base class of the node iterators,
-      /// thus they will convert to this type.
+      /// thus they convert to this type.
       class Node {
       public:
         /// Default constructor
 
-        /// @warning The default constructor sets the iterator
-        /// to an undefined value.
+        /// Default constructor.
+        /// \warning It sets the object to an undefined value.
         Node() { }
         /// Copy constructor.
 
@@ -82,40 +76,39 @@
         ///
         Node(const Node&) { }
 
-        /// Invalid constructor \& conversion.
+        /// %Invalid constructor \& conversion.
 
-        /// This constructor initializes the iterator to be invalid.
+        /// Initializes the object to be invalid.
         /// \sa Invalid for more details.
         Node(Invalid) { }
         /// Equality operator
 
+        /// Equality operator.
+        ///
         /// Two iterators are equal if and only if they point to the
-        /// same object or both are invalid.
+        /// same object or both are \c INVALID.
         bool operator==(Node) const { return true; }
 
         /// Inequality operator
 
-        /// \sa operator==(Node n)
-        ///
+        /// Inequality operator.
         bool operator!=(Node) const { return true; }
 
         /// Artificial ordering operator.
 
-        /// To allow the use of digraph descriptors as key type in std::map or
-        /// similar associative container we require this.
+        /// Artificial ordering operator.
         ///
-        /// \note This operator only have to define some strict ordering of
-        /// the items; this order has nothing to do with the iteration
-        /// ordering of the items.
+        /// \note This operator only has to define some strict ordering of
+        /// the nodes; this order has nothing to do with the iteration
+        /// ordering of the nodes.
         bool operator<(Node) const { return false; }
-
       };
 
-      /// This iterator goes through each node.
+      /// Iterator class for the nodes.
 
-      /// This iterator goes through each node.
+      /// This iterator goes through each node of the digraph.
       /// Its usage is quite simple, for example you can count the number
-      /// of nodes in digraph \c g of type \c Digraph like this:
+      /// of nodes in a digraph \c g of type \c %Digraph like this:
       ///\code
       /// int count=0;
       /// for (Digraph::NodeIt n(g); n!=INVALID; ++n) ++count;
@@ -124,30 +117,28 @@
       public:
         /// Default constructor
 
-        /// @warning The default constructor sets the iterator
-        /// to an undefined value.
+        /// Default constructor.
+        /// \warning It sets the iterator to an undefined value.
         NodeIt() { }
         /// Copy constructor.
 
         /// Copy constructor.
         ///
         NodeIt(const NodeIt& n) : Node(n) { }
-        /// Invalid constructor \& conversion.
+        /// %Invalid constructor \& conversion.
 
-        /// Initialize the iterator to be invalid.
+        /// Initializes the iterator to be invalid.
         /// \sa Invalid for more details.
         NodeIt(Invalid) { }
         /// Sets the iterator to the first node.
 
-        /// Sets the iterator to the first node of \c g.
+        /// Sets the iterator to the first node of the given digraph.
         ///
-        NodeIt(const Digraph&) { }
-        /// Node -> NodeIt conversion.
+        explicit NodeIt(const Digraph&) { }
+        /// Sets the iterator to the given node.
 
-        /// Sets the iterator to the node of \c the digraph pointed by
-        /// the trivial iterator.
-        /// This feature necessitates that each time we
-        /// iterate the arc-set, the iteration order is the same.
+        /// Sets the iterator to the given node of the given digraph.
+        ///
         NodeIt(const Digraph&, const Node&) { }
         /// Next node.
 
@@ -157,7 +148,7 @@
       };
 
 
-      /// Class for identifying an arc of the digraph
+      /// The arc type of the digraph
 
       /// This class identifies an arc of the digraph. It also serves
       /// as a base class of the arc iterators,
@@ -166,207 +157,214 @@
       public:
         /// Default constructor
 
-        /// @warning The default constructor sets the iterator
-        /// to an undefined value.
+        /// Default constructor.
+        /// \warning It sets the object to an undefined value.
         Arc() { }
         /// Copy constructor.
 
         /// Copy constructor.
         ///
         Arc(const Arc&) { }
-        /// Initialize the iterator to be invalid.
+        /// %Invalid constructor \& conversion.
 
-        /// Initialize the iterator to be invalid.
-        ///
+        /// Initializes the object to be invalid.
+        /// \sa Invalid for more details.
         Arc(Invalid) { }
         /// Equality operator
 
+        /// Equality operator.
+        ///
         /// Two iterators are equal if and only if they point to the
-        /// same object or both are invalid.
+        /// same object or both are \c INVALID.
         bool operator==(Arc) const { return true; }
         /// Inequality operator
 
-        /// \sa operator==(Arc n)
-        ///
+        /// Inequality operator.
         bool operator!=(Arc) const { return true; }
 
         /// Artificial ordering operator.
 
-        /// To allow the use of digraph descriptors as key type in std::map or
-        /// similar associative container we require this.
+        /// Artificial ordering operator.
         ///
-        /// \note This operator only have to define some strict ordering of
-        /// the items; this order has nothing to do with the iteration
-        /// ordering of the items.
+        /// \note This operator only has to define some strict ordering of
+        /// the arcs; this order has nothing to do with the iteration
+        /// ordering of the arcs.
         bool operator<(Arc) const { return false; }
       };
 
-      /// This iterator goes trough the outgoing arcs of a node.
+      /// Iterator class for the outgoing arcs of a node.
 
       /// This iterator goes trough the \e outgoing arcs of a certain node
       /// of a digraph.
       /// Its usage is quite simple, for example you can count the number
       /// of outgoing arcs of a node \c n
-      /// in digraph \c g of type \c Digraph as follows.
+      /// in a digraph \c g of type \c %Digraph as follows.
       ///\code
       /// int count=0;
-      /// for (Digraph::OutArcIt e(g, n); e!=INVALID; ++e) ++count;
+      /// for (Digraph::OutArcIt a(g, n); a!=INVALID; ++a) ++count;
       ///\endcode
-
       class OutArcIt : public Arc {
       public:
         /// Default constructor
 
-        /// @warning The default constructor sets the iterator
-        /// to an undefined value.
+        /// Default constructor.
+        /// \warning It sets the iterator to an undefined value.
         OutArcIt() { }
         /// Copy constructor.
 
         /// Copy constructor.
         ///
         OutArcIt(const OutArcIt& e) : Arc(e) { }
-        /// Initialize the iterator to be invalid.
+        /// %Invalid constructor \& conversion.
 
-        /// Initialize the iterator to be invalid.
+        /// Initializes the iterator to be invalid.
+        /// \sa Invalid for more details.
+        OutArcIt(Invalid) { }
+        /// Sets the iterator to the first outgoing arc.
+
+        /// Sets the iterator to the first outgoing arc of the given node.
         ///
-        OutArcIt(Invalid) { }
-        /// This constructor sets the iterator to the first outgoing arc.
+        OutArcIt(const Digraph&, const Node&) { }
+        /// Sets the iterator to the given arc.
 
-        /// This constructor sets the iterator to the first outgoing arc of
-        /// the node.
-        OutArcIt(const Digraph&, const Node&) { }
-        /// Arc -> OutArcIt conversion
-
-        /// Sets the iterator to the value of the trivial iterator.
-        /// This feature necessitates that each time we
-        /// iterate the arc-set, the iteration order is the same.
+        /// Sets the iterator to the given arc of the given digraph.
+        ///
         OutArcIt(const Digraph&, const Arc&) { }
-        ///Next outgoing arc
+        /// Next outgoing arc
 
         /// Assign the iterator to the next
         /// outgoing arc of the corresponding node.
         OutArcIt& operator++() { return *this; }
       };
 
-      /// This iterator goes trough the incoming arcs of a node.
+      /// Iterator class for the incoming arcs of a node.
 
       /// This iterator goes trough the \e incoming arcs of a certain node
       /// of a digraph.
       /// Its usage is quite simple, for example you can count the number
-      /// of outgoing arcs of a node \c n
-      /// in digraph \c g of type \c Digraph as follows.
+      /// of incoming arcs of a node \c n
+      /// in a digraph \c g of type \c %Digraph as follows.



More information about the Lemon-commits mailing list