Improving UGraph and BpUGraph concept classes
authordeba
Mon, 24 Jul 2006 16:08:34 +0000
changeset 2163bef3457be038
parent 2162 6831fa007688
child 2164 160ca7667159
Improving UGraph and BpUGraph concept classes
lemon/concept/bpugraph.h
lemon/concept/ugraph.h
     1.1 --- a/lemon/concept/bpugraph.h	Mon Jul 24 09:51:28 2006 +0000
     1.2 +++ b/lemon/concept/bpugraph.h	Mon Jul 24 16:08:34 2006 +0000
     1.3 @@ -55,11 +55,12 @@
     1.4      /// as an undirected graph and consequently as a static graph.
     1.5      ///
     1.6      /// The bipartite graph stores two types of nodes which are named
     1.7 -    /// ANode and BNode. The graph type contains two types ANode and BNode
     1.8 -    /// which are inherited from Node type. Moreover they have
     1.9 -    /// constructor which converts Node to either ANode or BNode when it is
    1.10 -    /// possible. Therefor everywhere the Node type can be used instead of
    1.11 -    /// ANode and BNode. So the usage of the ANode and BNode is suggested.  
    1.12 +    /// ANode and BNode. The graph type contains two types ANode and
    1.13 +    /// BNode which are inherited from Node type. Moreover they have
    1.14 +    /// constructor which converts Node to either ANode or BNode when
    1.15 +    /// it is possible. Therefor everywhere the Node type can be used
    1.16 +    /// instead of ANode and BNode. So the usage of the ANode and
    1.17 +    /// BNode is not suggested.
    1.18      ///
    1.19      /// The iteration on the partition can be done with the ANodeIt and 
    1.20      /// BNodeIt classes. The node map can be used to map values to the nodes
    1.21 @@ -68,8 +69,12 @@
    1.22  
    1.23      class BpUGraph {
    1.24      public:
    1.25 -      /// \todo undocumented
    1.26 +      /// \brief The undirected graph should be tagged by the
    1.27 +      /// UndirectedTag.
    1.28        ///
    1.29 +      /// The undirected graph should be tagged by the UndirectedTag. This
    1.30 +      /// tag helps the enable_if technics to make compile time 
    1.31 +      /// specializations for undirected graphs.  
    1.32        typedef True UndirectedTag;
    1.33  
    1.34        /// \brief The base type of node iterators, 
    1.35 @@ -122,15 +127,12 @@
    1.36  
    1.37        };
    1.38  
    1.39 -      /// \brief The base type of anode iterators, 
    1.40 -      /// or in other words, the trivial anode iterator.
    1.41 +      /// \brief Helper class for ANodes.
    1.42        ///
    1.43 -      /// This is the base type of each anode iterator,
    1.44 -      /// thus each kind of anode iterator converts to this.
    1.45 -      /// More precisely each kind of node iterator should be inherited 
    1.46 -      /// from the trivial anode iterator. The ANode class should be used
    1.47 -      /// only in special cases. Usually the Node type should be used insted
    1.48 -      /// of it. 
    1.49 +      /// This class is just a helper class for ANodes, it is not
    1.50 +      /// suggested to use it directly. It can be converted easily to
    1.51 +      /// node and vice versa. The usage of this class is limited
    1.52 +      /// two use just as template parameters for special map types. 
    1.53        class ANode {
    1.54        public:
    1.55          /// Default constructor
    1.56 @@ -179,15 +181,12 @@
    1.57  
    1.58        };
    1.59  
    1.60 -      /// \brief The base type of bnode iterators, 
    1.61 -      /// or in other words, the trivial bnode iterator.
    1.62 +      /// \brief Helper class for BNodes.
    1.63        ///
    1.64 -      /// This is the base type of each anode iterator,
    1.65 -      /// thus each kind of anode iterator converts to this.
    1.66 -      /// More precisely each kind of node iterator should be inherited 
    1.67 -      /// from the trivial anode iterator. The BNode class should be used
    1.68 -      /// only in special cases. Usually the Node type should be used insted
    1.69 -      /// of it. 
    1.70 +      /// This class is just a helper class for BNodes, it is not
    1.71 +      /// suggested to use it directly. It can be converted easily to
    1.72 +      /// node and vice versa. The usage of this class is limited
    1.73 +      /// two use just as template parameters for special map types. 
    1.74        class BNode {
    1.75        public:
    1.76          /// Default constructor
    1.77 @@ -290,7 +289,7 @@
    1.78        /// int count=0;
    1.79        /// for (Graph::ANodeIt n(g); n!=INVALID; ++n) ++count;
    1.80        ///\endcode
    1.81 -      class ANodeIt : public ANode {
    1.82 +      class ANodeIt : public Node {
    1.83        public:
    1.84          /// Default constructor
    1.85  
    1.86 @@ -335,7 +334,7 @@
    1.87        /// int count=0;
    1.88        /// for (Graph::BNodeIt n(g); n!=INVALID; ++n) ++count;
    1.89        ///\endcode
    1.90 -      class BNodeIt : public BNode {
    1.91 +      class BNodeIt : public Node {
    1.92        public:
    1.93          /// Default constructor
    1.94  
    1.95 @@ -818,16 +817,17 @@
    1.96        /// \brief Direct the given undirected edge.
    1.97        ///
    1.98        /// Direct the given undirected edge. The returned edge source
    1.99 -      /// will be the given edge.
   1.100 +      /// will be the given node.
   1.101        Edge direct(const UEdge&, const Node&) const {
   1.102  	return INVALID;
   1.103        }
   1.104  
   1.105        /// \brief Direct the given undirected edge.
   1.106        ///
   1.107 -      /// Direct the given undirected edge. The returned edge source
   1.108 -      /// will be the source of the undirected edge if the given bool
   1.109 -      /// is true.
   1.110 +      /// Direct the given undirected edge. The returned edge
   1.111 +      /// represents the given undireted edge and the direction comes
   1.112 +      /// from the given bool.  The source of the undirected edge and
   1.113 +      /// the directed edge is the same when the given bool is true.
   1.114        Edge direct(const UEdge&, bool) const {
   1.115  	return INVALID;
   1.116        }
   1.117 @@ -855,7 +855,7 @@
   1.118        /// \brief Returns true if the edge has default orientation.
   1.119        ///
   1.120        /// Returns whether the given directed edge is same orientation as
   1.121 -      /// the corresponding undirected edge.
   1.122 +      /// the corresponding undirected edge's default orientation.
   1.123        bool direction(Edge) const { return true; }
   1.124  
   1.125        /// \brief Returns the opposite directed edge.
   1.126 @@ -865,14 +865,14 @@
   1.127  
   1.128        /// \brief Opposite node on an edge
   1.129        ///
   1.130 -      /// \return the opposite of the given Node on the given Edge
   1.131 +      /// \return the opposite of the given Node on the given UEdge
   1.132        Node oppositeNode(Node, UEdge) const { return INVALID; }
   1.133  
   1.134        /// \brief First node of the undirected edge.
   1.135        ///
   1.136        /// \return the first node of the given UEdge.
   1.137        ///
   1.138 -      /// Naturally uectected edges don't have direction and thus
   1.139 +      /// Naturally undirected edges don't have direction and thus
   1.140        /// don't have source and target node. But we use these two methods
   1.141        /// to query the two endnodes of the edge. The direction of the edge
   1.142        /// which arises this way is called the inherent direction of the
     2.1 --- a/lemon/concept/ugraph.h	Mon Jul 24 09:51:28 2006 +0000
     2.2 +++ b/lemon/concept/ugraph.h	Mon Jul 24 16:08:34 2006 +0000
     2.3 @@ -35,31 +35,48 @@
     2.4      /// @{
     2.5  
     2.6  
     2.7 -    /// Class describing the concept of Undirected Graphs.
     2.8 -
     2.9 +    /// \brief Class describing the concept of Undirected Graphs.
    2.10 +    ///
    2.11      /// This class describes the common interface of all Undirected
    2.12      /// Graphs.
    2.13      ///
    2.14      /// As all concept describing classes it provides only interface
    2.15      /// without any sensible implementation. So any algorithm for
    2.16      /// undirected graph should compile with this class, but it will not
    2.17 -    /// run properly, of couse.
    2.18 +    /// run properly, of course.
    2.19      ///
    2.20 -    /// In LEMON undirected graphs also fulfill the concept of directed
    2.21 -    /// graphs (\ref lemon::concept::Graph "Graph Concept"). For
    2.22 -    /// explanation of this and more see also the page \ref graphs,
    2.23 -    /// a tutorial about graphs.
    2.24 +    /// The LEMON undirected graphs also fulfill the concept of
    2.25 +    /// directed graphs (\ref lemon::concept::Graph "Graph
    2.26 +    /// Concept"). Each undirected edges can be seen as two opposite
    2.27 +    /// directed edge and consequently the undirected graph can be
    2.28 +    /// seen as the direceted graph of these directed edges. The
    2.29 +    /// UGraph has the UEdge inner class for the undirected edges and
    2.30 +    /// the Edge type for the directed edges. The Edge type is
    2.31 +    /// convertible to UEdge or inherited from it so from a directed
    2.32 +    /// edge we can get the represented undirected edge.
    2.33      ///
    2.34 -    /// You can assume that all undirected graph can be handled
    2.35 -    /// as a directed graph. This way it is fully conform
    2.36 -    /// to the Graph concept.
    2.37 -
    2.38 +    /// In the sense of the LEMON each undirected edge has a default
    2.39 +    /// direction (it should be in every computer implementation,
    2.40 +    /// because the order of undirected edge's nodes defines an
    2.41 +    /// orientation). With the default orientation we can define that
    2.42 +    /// the directed edge is forward or backward directed. With the \c
    2.43 +    /// direction() and \c direct() function we can get the direction
    2.44 +    /// of the directed edge and we can direct an undirected edge.
    2.45 +    ///
    2.46 +    /// The UEdgeIt is an iterator for the undirected edges. We can use
    2.47 +    /// the UEdgeMap to map values for the undirected edges. The InEdgeIt and
    2.48 +    /// OutEdgeIt iterates on the same undirected edges but with opposite
    2.49 +    /// direction. The IncEdgeIt iterates also on the same undirected edges
    2.50 +    /// as the OutEdgeIt and InEdgeIt but it is not convertible to Edge just
    2.51 +    /// to UEdge.  
    2.52      class UGraph {
    2.53      public:
    2.54 -      ///\e
    2.55 -
    2.56 -      ///\todo undocumented
    2.57 +      /// \brief The undirected graph should be tagged by the
    2.58 +      /// UndirectedTag.
    2.59        ///
    2.60 +      /// The undirected graph should be tagged by the UndirectedTag. This
    2.61 +      /// tag helps the enable_if technics to make compile time 
    2.62 +      /// specializations for undirected graphs.  
    2.63        typedef True UndirectedTag;
    2.64  
    2.65        /// \brief The base type of node iterators, 
    2.66 @@ -296,7 +313,8 @@
    2.67        /// The directed edge type.
    2.68  
    2.69        /// The directed edge type. It can be converted to the
    2.70 -      /// undirected edge.
    2.71 +      /// undirected edge or it should be inherited from the undirected
    2.72 +      /// edge.
    2.73        class Edge : public UEdge {
    2.74        public:
    2.75          /// Default constructor
    2.76 @@ -562,16 +580,17 @@
    2.77        /// \brief Direct the given undirected edge.
    2.78        ///
    2.79        /// Direct the given undirected edge. The returned edge source
    2.80 -      /// will be the given edge.
    2.81 +      /// will be the given node.
    2.82        Edge direct(const UEdge&, const Node&) const {
    2.83  	return INVALID;
    2.84        }
    2.85  
    2.86        /// \brief Direct the given undirected edge.
    2.87        ///
    2.88 -      /// Direct the given undirected edge. The returned edge source
    2.89 -      /// will be the source of the undirected edge if the given bool
    2.90 -      /// is true.
    2.91 +      /// Direct the given undirected edge. The returned edge
    2.92 +      /// represents the given undireted edge and the direction comes
    2.93 +      /// from the given bool.  The source of the undirected edge and
    2.94 +      /// the directed edge is the same when the given bool is true.
    2.95        Edge direct(const UEdge&, bool) const {
    2.96  	return INVALID;
    2.97        }
    2.98 @@ -579,7 +598,7 @@
    2.99        /// \brief Returns true if the edge has default orientation.
   2.100        ///
   2.101        /// Returns whether the given directed edge is same orientation as
   2.102 -      /// the corresponding undirected edge.
   2.103 +      /// the corresponding undirected edge's default orientation.
   2.104        bool direction(Edge) const { return true; }
   2.105  
   2.106        /// \brief Returns the opposite directed edge.
   2.107 @@ -589,16 +608,16 @@
   2.108  
   2.109        /// \brief Opposite node on an edge
   2.110        ///
   2.111 -      /// \return the opposite of the given Node on the given Edge
   2.112 +      /// \return the opposite of the given Node on the given UEdge
   2.113        Node oppositeNode(Node, UEdge) const { return INVALID; }
   2.114  
   2.115        /// \brief First node of the undirected edge.
   2.116        ///
   2.117        /// \return the first node of the given UEdge.
   2.118        ///
   2.119 -      /// Naturally uectected edges don't have direction and thus
   2.120 +      /// Naturally undirected edges don't have direction and thus
   2.121        /// don't have source and target node. But we use these two methods
   2.122 -      /// to query the two endnodes of the edge. The direction of the edge
   2.123 +      /// to query the two nodes of the edge. The direction of the edge
   2.124        /// which arises this way is called the inherent direction of the
   2.125        /// undirected edge, and is used to define the "default" direction
   2.126        /// of the directed versions of the edges.