COIN-OR::LEMON - Graph Library

Changeset 1933:a876a3d6a4c7 in lemon-0.x for lemon/concept


Ignore:
Timestamp:
01/31/06 21:04:36 (18 years ago)
Author:
Balazs Dezso
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>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/concept/bpugraph.h

    r1911 r1933  
    5757    ///
    5858    /// The bipartite graph stores two types of nodes which are named
    59     /// ANode and BNode. Even so the graph type does not contain ANode
    60     /// and BNode classes, becaue the nodes can be accessed just with the
    61     /// common Node class.
     59    /// ANode and BNode. The graph type contains two types ANode and BNode
     60    /// which are inherited from Node type. Moreover they have
     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. 
    6264    ///
    6365    /// The iteration on the partition can be done with the ANodeIt and
     
    123125
    124126      };
     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      };
    125241   
    126242      /// This iterator goes through each node.
     
    178294      /// for (Graph::ANodeIt n(g); n!=INVALID; ++n) ++count;
    179295      /// \endcode
    180       class ANodeIt : public Node {
     296      class ANodeIt : public ANode {
    181297      public:
    182298        /// Default constructor
     
    223339      /// for (Graph::BNodeIt n(g); n!=INVALID; ++n) ++count;
    224340      /// \endcode
    225       class BNodeIt : public Node {
     341      class BNodeIt : public BNode {
    226342      public:
    227343        /// Default constructor
Note: See TracChangeset for help on using the changeset viewer.