# Changeset 1933:a876a3d6a4c7 in lemon-0.x

Ignore:
Timestamp:
01/31/06 21:04:36 (15 years ago)
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2508
Message:

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?<Graph, ANode>
InvertableMap?<Graph, ANode, string>
IterableBoolMap?<Graph, ANode>
IterableIntMap?<Graph, ANode>
IterableValueMap?<Graph, ANode, string>

Location:
lemon
Files:
2 edited

Unmodified
Added
Removed
• ## lemon/bits/iterable_graph_extender.h

 r1910 }; class ANodeIt : public Node { class ANodeIt : public ANode { friend class IterableBpUGraphExtender; const Graph* graph; }; class BNodeIt : public Node { class BNodeIt : public BNode { friend class IterableBpUGraphExtender; const Graph* graph;
• ## lemon/concept/bpugraph.h

 r1911 /// /// 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 }; /// \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. /// for (Graph::ANodeIt n(g); n!=INVALID; ++n) ++count; /// \endcode class ANodeIt : public Node { class ANodeIt : public ANode { public: /// Default constructor /// for (Graph::BNodeIt n(g); n!=INVALID; ++n) ++count; /// \endcode class BNodeIt : public Node { class BNodeIt : public BNode { public: /// Default constructor
Note: See TracChangeset for help on using the changeset viewer.