# HG changeset patch # User deba # Date 1138737876 0 # Node ID a876a3d6a4c7b50a3b30c38b78a9ae58e2eaf2fa # Parent c65711e5a26d2e22fcc633f943742fae8ecb3f97 Revising the bpugraph concept We need a public but very limited ANode and BNode class It can be used with ItemSetTraits and with some special maps By example: DescriptorMap InvertableMap IterableBoolMap IterableIntMap IterableValueMap diff -r c65711e5a26d -r a876a3d6a4c7 lemon/bits/iterable_graph_extender.h --- a/lemon/bits/iterable_graph_extender.h Tue Jan 31 19:57:35 2006 +0000 +++ b/lemon/bits/iterable_graph_extender.h Tue Jan 31 20:04:36 2006 +0000 @@ -303,7 +303,7 @@ }; - class ANodeIt : public Node { + class ANodeIt : public ANode { friend class IterableBpUGraphExtender; const Graph* graph; public: @@ -325,7 +325,7 @@ } }; - class BNodeIt : public Node { + class BNodeIt : public BNode { friend class IterableBpUGraphExtender; const Graph* graph; public: diff -r c65711e5a26d -r a876a3d6a4c7 lemon/concept/bpugraph.h --- a/lemon/concept/bpugraph.h Tue Jan 31 19:57:35 2006 +0000 +++ b/lemon/concept/bpugraph.h Tue Jan 31 20:04:36 2006 +0000 @@ -56,9 +56,11 @@ /// as an undirected graph and consequently as a static graph. /// /// The bipartite graph stores two types of nodes which are named - /// ANode and BNode. Even so the graph type does not contain ANode - /// and BNode classes, becaue the nodes can be accessed just with the - /// common Node class. + /// ANode and BNode. The graph type contains two types ANode and BNode + /// which are inherited from Node type. Moreover they have + /// constructor which converts Node to either ANode or BNode when it is + /// possible. Therefor everywhere the Node type can be used instead of + /// ANode and BNode. So the usage of the ANode and BNode is suggested. /// /// The iteration on the partition can be done with the ANodeIt and /// BNodeIt classes. The node map can be used to map values to the nodes @@ -122,6 +124,120 @@ bool operator<(Node) const { return false; } }; + + /// \brief The base type of anode iterators, + /// or in other words, the trivial anode iterator. + /// + /// This is the base type of each anode iterator, + /// thus each kind of anode iterator converts to this. + /// More precisely each kind of node iterator should be inherited + /// from the trivial anode iterator. The ANode class should be used + /// only in special cases. Usually the Node type should be used insted + /// of it. + class ANode { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + ANode() { } + /// Copy constructor. + + /// Copy constructor. + /// + ANode(const ANode&) { } + + /// Construct the same node as ANode. + + /// Construct the same node as ANode. It may throws assertion + /// when the given node is from the BNode set. + ANode(const Node&) { } + + /// Invalid constructor \& conversion. + + /// This constructor initializes the iterator to be invalid. + /// \sa Invalid for more details. + ANode(Invalid) { } + /// Equality operator + + /// Two iterators are equal if and only if they point to the + /// same object or both are invalid. + bool operator==(ANode) const { return true; } + + /// Inequality operator + + /// \sa operator==(ANode n) + /// + bool operator!=(ANode) const { return true; } + + /// Artificial ordering operator. + + /// To allow the use of graph descriptors as key type in std::map or + /// similar associative container we require this. + /// + /// \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. + bool operator<(ANode) const { return false; } + + }; + + /// \brief The base type of bnode iterators, + /// or in other words, the trivial bnode iterator. + /// + /// This is the base type of each anode iterator, + /// thus each kind of anode iterator converts to this. + /// More precisely each kind of node iterator should be inherited + /// from the trivial anode iterator. The BNode class should be used + /// only in special cases. Usually the Node type should be used insted + /// of it. + class BNode { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + BNode() { } + /// Copy constructor. + + /// Copy constructor. + /// + BNode(const BNode&) { } + + /// Construct the same node as BNode. + + /// Construct the same node as BNode. It may throws assertion + /// when the given node is from the ANode set. + BNode(const Node&) { } + + /// Invalid constructor \& conversion. + + /// This constructor initializes the iterator to be invalid. + /// \sa Invalid for more details. + BNode(Invalid) { } + /// Equality operator + + /// Two iterators are equal if and only if they point to the + /// same object or both are invalid. + bool operator==(BNode) const { return true; } + + /// Inequality operator + + /// \sa operator==(BNode n) + /// + bool operator!=(BNode) const { return true; } + + /// Artificial ordering operator. + + /// To allow the use of graph descriptors as key type in std::map or + /// similar associative container we require this. + /// + /// \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. + bool operator<(BNode) const { return false; } + + }; /// This iterator goes through each node. @@ -177,7 +293,7 @@ /// int count=0; /// for (Graph::ANodeIt n(g); n!=INVALID; ++n) ++count; /// \endcode - class ANodeIt : public Node { + class ANodeIt : public ANode { public: /// Default constructor @@ -222,7 +338,7 @@ /// int count=0; /// for (Graph::BNodeIt n(g); n!=INVALID; ++n) ++count; /// \endcode - class BNodeIt : public Node { + class BNodeIt : public BNode { public: /// Default constructor