lemon/concept/bpugraph.h
changeset 1941 9fe177e0437d
parent 1911 c925a077cf73
child 1946 17eb3eaad9f8
equal deleted inserted replaced
0:62718195a916 1:a2bf8b5c61f7
    54     ///
    54     ///
    55     /// You can assume that all undirected bipartite graph can be handled
    55     /// You can assume that all undirected bipartite graph can be handled
    56     /// as an undirected graph and consequently as a static graph.
    56     /// as an undirected graph and consequently as a static graph.
    57     ///
    57     ///
    58     /// The bipartite graph stores two types of nodes which are named
    58     /// The bipartite graph stores two types of nodes which are named
    59     /// ANode and BNode. Even so the graph type does not contain ANode
    59     /// ANode and BNode. The graph type contains two types ANode and BNode
    60     /// and BNode classes, becaue the nodes can be accessed just with the
    60     /// which are inherited from Node type. Moreover they have
    61     /// common Node class. 
    61     /// constructor which converts Node to either ANode or BNode when it is
       
    62     /// possible. Therefor everywhere the Node type can be used instead of
       
    63     /// ANode and BNode. So the usage of the ANode and BNode is suggested.  
    62     ///
    64     ///
    63     /// The iteration on the partition can be done with the ANodeIt and 
    65     /// The iteration on the partition can be done with the ANodeIt and 
    64     /// BNodeIt classes. The node map can be used to map values to the nodes
    66     /// BNodeIt classes. The node map can be used to map values to the nodes
    65     /// and similarly we can use to map values for just the ANodes and
    67     /// and similarly we can use to map values for just the ANodes and
    66     /// BNodes the ANodeMap and BNodeMap template classes.
    68     /// BNodes the ANodeMap and BNodeMap template classes.
   120 	///
   122 	///
   121 	/// \bug This is a technical requirement. Do we really need this?
   123 	/// \bug This is a technical requirement. Do we really need this?
   122 	bool operator<(Node) const { return false; }
   124 	bool operator<(Node) const { return false; }
   123 
   125 
   124       };
   126       };
       
   127 
       
   128       /// \brief The base type of anode iterators, 
       
   129       /// or in other words, the trivial anode iterator.
       
   130       ///
       
   131       /// This is the base type of each anode iterator,
       
   132       /// thus each kind of anode iterator converts to this.
       
   133       /// More precisely each kind of node iterator should be inherited 
       
   134       /// from the trivial anode iterator. The ANode class should be used
       
   135       /// only in special cases. Usually the Node type should be used insted
       
   136       /// of it. 
       
   137       class ANode {
       
   138       public:
       
   139         /// Default constructor
       
   140 
       
   141         /// @warning The default constructor sets the iterator
       
   142         /// to an undefined value.
       
   143         ANode() { }
       
   144         /// Copy constructor.
       
   145 
       
   146         /// Copy constructor.
       
   147         ///
       
   148         ANode(const ANode&) { }
       
   149 
       
   150         /// Construct the same node as ANode.
       
   151 
       
   152         /// Construct the same node as ANode. It may throws assertion
       
   153         /// when the given node is from the BNode set.
       
   154         ANode(const Node&) { }
       
   155 
       
   156         /// Invalid constructor \& conversion.
       
   157 
       
   158         /// This constructor initializes the iterator to be invalid.
       
   159         /// \sa Invalid for more details.
       
   160         ANode(Invalid) { }
       
   161         /// Equality operator
       
   162 
       
   163         /// Two iterators are equal if and only if they point to the
       
   164         /// same object or both are invalid.
       
   165         bool operator==(ANode) const { return true; }
       
   166 
       
   167         /// Inequality operator
       
   168         
       
   169         /// \sa operator==(ANode n)
       
   170         ///
       
   171         bool operator!=(ANode) const { return true; }
       
   172 
       
   173 	/// Artificial ordering operator.
       
   174 	
       
   175 	/// To allow the use of graph descriptors as key type in std::map or
       
   176 	/// similar associative container we require this.
       
   177 	///
       
   178 	/// \note This operator only have to define some strict ordering of
       
   179 	/// the items; this order has nothing to do with the iteration
       
   180 	/// ordering of the items.
       
   181 	bool operator<(ANode) const { return false; }
       
   182 
       
   183       };
       
   184 
       
   185       /// \brief The base type of bnode iterators, 
       
   186       /// or in other words, the trivial bnode iterator.
       
   187       ///
       
   188       /// This is the base type of each anode iterator,
       
   189       /// thus each kind of anode iterator converts to this.
       
   190       /// More precisely each kind of node iterator should be inherited 
       
   191       /// from the trivial anode iterator. The BNode class should be used
       
   192       /// only in special cases. Usually the Node type should be used insted
       
   193       /// of it. 
       
   194       class BNode {
       
   195       public:
       
   196         /// Default constructor
       
   197 
       
   198         /// @warning The default constructor sets the iterator
       
   199         /// to an undefined value.
       
   200         BNode() { }
       
   201         /// Copy constructor.
       
   202 
       
   203         /// Copy constructor.
       
   204         ///
       
   205         BNode(const BNode&) { }
       
   206 
       
   207         /// Construct the same node as BNode.
       
   208 
       
   209         /// Construct the same node as BNode. It may throws assertion
       
   210         /// when the given node is from the ANode set.
       
   211         BNode(const Node&) { }
       
   212 
       
   213         /// Invalid constructor \& conversion.
       
   214 
       
   215         /// This constructor initializes the iterator to be invalid.
       
   216         /// \sa Invalid for more details.
       
   217         BNode(Invalid) { }
       
   218         /// Equality operator
       
   219 
       
   220         /// Two iterators are equal if and only if they point to the
       
   221         /// same object or both are invalid.
       
   222         bool operator==(BNode) const { return true; }
       
   223 
       
   224         /// Inequality operator
       
   225         
       
   226         /// \sa operator==(BNode n)
       
   227         ///
       
   228         bool operator!=(BNode) const { return true; }
       
   229 
       
   230 	/// Artificial ordering operator.
       
   231 	
       
   232 	/// To allow the use of graph descriptors as key type in std::map or
       
   233 	/// similar associative container we require this.
       
   234 	///
       
   235 	/// \note This operator only have to define some strict ordering of
       
   236 	/// the items; this order has nothing to do with the iteration
       
   237 	/// ordering of the items.
       
   238 	bool operator<(BNode) const { return false; }
       
   239 
       
   240       };
   125     
   241     
   126       /// This iterator goes through each node.
   242       /// This iterator goes through each node.
   127 
   243 
   128       /// This iterator goes through each node.
   244       /// This iterator goes through each node.
   129       /// Its usage is quite simple, for example you can count the number
   245       /// Its usage is quite simple, for example you can count the number
   175       /// of nodes in graph \c g of type \c Graph like this:
   291       /// of nodes in graph \c g of type \c Graph like this:
   176       /// \code
   292       /// \code
   177       /// int count=0;
   293       /// int count=0;
   178       /// for (Graph::ANodeIt n(g); n!=INVALID; ++n) ++count;
   294       /// for (Graph::ANodeIt n(g); n!=INVALID; ++n) ++count;
   179       /// \endcode
   295       /// \endcode
   180       class ANodeIt : public Node {
   296       class ANodeIt : public ANode {
   181       public:
   297       public:
   182         /// Default constructor
   298         /// Default constructor
   183 
   299 
   184         /// @warning The default constructor sets the iterator
   300         /// @warning The default constructor sets the iterator
   185         /// to an undefined value.
   301         /// to an undefined value.
   220       /// of nodes in graph \c g of type \c Graph like this:
   336       /// of nodes in graph \c g of type \c Graph like this:
   221       /// \code
   337       /// \code
   222       /// int count=0;
   338       /// int count=0;
   223       /// for (Graph::BNodeIt n(g); n!=INVALID; ++n) ++count;
   339       /// for (Graph::BNodeIt n(g); n!=INVALID; ++n) ++count;
   224       /// \endcode
   340       /// \endcode
   225       class BNodeIt : public Node {
   341       class BNodeIt : public BNode {
   226       public:
   342       public:
   227         /// Default constructor
   343         /// Default constructor
   228 
   344 
   229         /// @warning The default constructor sets the iterator
   345         /// @warning The default constructor sets the iterator
   230         /// to an undefined value.
   346         /// to an undefined value.