lemon/concept/bpugraph.h
changeset 1933 a876a3d6a4c7
parent 1911 c925a077cf73
child 1946 17eb3eaad9f8
     1.1 --- a/lemon/concept/bpugraph.h	Tue Jan 31 19:57:35 2006 +0000
     1.2 +++ b/lemon/concept/bpugraph.h	Tue Jan 31 20:04:36 2006 +0000
     1.3 @@ -56,9 +56,11 @@
     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. Even so the graph type does not contain ANode
     1.8 -    /// and BNode classes, becaue the nodes can be accessed just with the
     1.9 -    /// common Node class. 
    1.10 +    /// ANode and BNode. The graph type contains two types ANode and BNode
    1.11 +    /// which are inherited from Node type. Moreover they have
    1.12 +    /// constructor which converts Node to either ANode or BNode when it is
    1.13 +    /// possible. Therefor everywhere the Node type can be used instead of
    1.14 +    /// ANode and BNode. So the usage of the ANode and BNode is suggested.  
    1.15      ///
    1.16      /// The iteration on the partition can be done with the ANodeIt and 
    1.17      /// BNodeIt classes. The node map can be used to map values to the nodes
    1.18 @@ -122,6 +124,120 @@
    1.19  	bool operator<(Node) const { return false; }
    1.20  
    1.21        };
    1.22 +
    1.23 +      /// \brief The base type of anode iterators, 
    1.24 +      /// or in other words, the trivial anode iterator.
    1.25 +      ///
    1.26 +      /// This is the base type of each anode iterator,
    1.27 +      /// thus each kind of anode iterator converts to this.
    1.28 +      /// More precisely each kind of node iterator should be inherited 
    1.29 +      /// from the trivial anode iterator. The ANode class should be used
    1.30 +      /// only in special cases. Usually the Node type should be used insted
    1.31 +      /// of it. 
    1.32 +      class ANode {
    1.33 +      public:
    1.34 +        /// Default constructor
    1.35 +
    1.36 +        /// @warning The default constructor sets the iterator
    1.37 +        /// to an undefined value.
    1.38 +        ANode() { }
    1.39 +        /// Copy constructor.
    1.40 +
    1.41 +        /// Copy constructor.
    1.42 +        ///
    1.43 +        ANode(const ANode&) { }
    1.44 +
    1.45 +        /// Construct the same node as ANode.
    1.46 +
    1.47 +        /// Construct the same node as ANode. It may throws assertion
    1.48 +        /// when the given node is from the BNode set.
    1.49 +        ANode(const Node&) { }
    1.50 +
    1.51 +        /// Invalid constructor \& conversion.
    1.52 +
    1.53 +        /// This constructor initializes the iterator to be invalid.
    1.54 +        /// \sa Invalid for more details.
    1.55 +        ANode(Invalid) { }
    1.56 +        /// Equality operator
    1.57 +
    1.58 +        /// Two iterators are equal if and only if they point to the
    1.59 +        /// same object or both are invalid.
    1.60 +        bool operator==(ANode) const { return true; }
    1.61 +
    1.62 +        /// Inequality operator
    1.63 +        
    1.64 +        /// \sa operator==(ANode n)
    1.65 +        ///
    1.66 +        bool operator!=(ANode) const { return true; }
    1.67 +
    1.68 +	/// Artificial ordering operator.
    1.69 +	
    1.70 +	/// To allow the use of graph descriptors as key type in std::map or
    1.71 +	/// similar associative container we require this.
    1.72 +	///
    1.73 +	/// \note This operator only have to define some strict ordering of
    1.74 +	/// the items; this order has nothing to do with the iteration
    1.75 +	/// ordering of the items.
    1.76 +	bool operator<(ANode) const { return false; }
    1.77 +
    1.78 +      };
    1.79 +
    1.80 +      /// \brief The base type of bnode iterators, 
    1.81 +      /// or in other words, the trivial bnode iterator.
    1.82 +      ///
    1.83 +      /// This is the base type of each anode iterator,
    1.84 +      /// thus each kind of anode iterator converts to this.
    1.85 +      /// More precisely each kind of node iterator should be inherited 
    1.86 +      /// from the trivial anode iterator. The BNode class should be used
    1.87 +      /// only in special cases. Usually the Node type should be used insted
    1.88 +      /// of it. 
    1.89 +      class BNode {
    1.90 +      public:
    1.91 +        /// Default constructor
    1.92 +
    1.93 +        /// @warning The default constructor sets the iterator
    1.94 +        /// to an undefined value.
    1.95 +        BNode() { }
    1.96 +        /// Copy constructor.
    1.97 +
    1.98 +        /// Copy constructor.
    1.99 +        ///
   1.100 +        BNode(const BNode&) { }
   1.101 +
   1.102 +        /// Construct the same node as BNode.
   1.103 +
   1.104 +        /// Construct the same node as BNode. It may throws assertion
   1.105 +        /// when the given node is from the ANode set.
   1.106 +        BNode(const Node&) { }
   1.107 +
   1.108 +        /// Invalid constructor \& conversion.
   1.109 +
   1.110 +        /// This constructor initializes the iterator to be invalid.
   1.111 +        /// \sa Invalid for more details.
   1.112 +        BNode(Invalid) { }
   1.113 +        /// Equality operator
   1.114 +
   1.115 +        /// Two iterators are equal if and only if they point to the
   1.116 +        /// same object or both are invalid.
   1.117 +        bool operator==(BNode) const { return true; }
   1.118 +
   1.119 +        /// Inequality operator
   1.120 +        
   1.121 +        /// \sa operator==(BNode n)
   1.122 +        ///
   1.123 +        bool operator!=(BNode) const { return true; }
   1.124 +
   1.125 +	/// Artificial ordering operator.
   1.126 +	
   1.127 +	/// To allow the use of graph descriptors as key type in std::map or
   1.128 +	/// similar associative container we require this.
   1.129 +	///
   1.130 +	/// \note This operator only have to define some strict ordering of
   1.131 +	/// the items; this order has nothing to do with the iteration
   1.132 +	/// ordering of the items.
   1.133 +	bool operator<(BNode) const { return false; }
   1.134 +
   1.135 +      };
   1.136      
   1.137        /// This iterator goes through each node.
   1.138  
   1.139 @@ -177,7 +293,7 @@
   1.140        /// int count=0;
   1.141        /// for (Graph::ANodeIt n(g); n!=INVALID; ++n) ++count;
   1.142        /// \endcode
   1.143 -      class ANodeIt : public Node {
   1.144 +      class ANodeIt : public ANode {
   1.145        public:
   1.146          /// Default constructor
   1.147  
   1.148 @@ -222,7 +338,7 @@
   1.149        /// int count=0;
   1.150        /// for (Graph::BNodeIt n(g); n!=INVALID; ++n) ++count;
   1.151        /// \endcode
   1.152 -      class BNodeIt : public Node {
   1.153 +      class BNodeIt : public BNode {
   1.154        public:
   1.155          /// Default constructor
   1.156