lemon/concepts/bpugraph.h
author deba
Tue, 06 Mar 2007 17:04:16 +0000
changeset 2395 fe5966d8acfc
parent 2291 fbc4af1f9378
child 2474 e6368948d5f7
permissions -rw-r--r--
Correction of urls and email addresses
     1 /* -*- C++ -*-
     2  *
     3  * This file is a part of LEMON, a generic C++ optimization library
     4  *
     5  * Copyright (C) 2003-2007
     6  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     7  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     8  *
     9  * Permission to use, modify and distribute this software is granted
    10  * provided that this copyright notice appears in all copies. For
    11  * precise terms see the accompanying LICENSE file.
    12  *
    13  * This software is provided "AS IS" with no warranty of any kind,
    14  * express or implied, and with no claim as to its suitability for any
    15  * purpose.
    16  *
    17  */
    18 
    19 /// \ingroup graph_concepts
    20 /// \file
    21 /// \brief Undirected bipartite graphs and components of.
    22 
    23 
    24 #ifndef LEMON_CONCEPT_BPUGRAPH_H
    25 #define LEMON_CONCEPT_BPUGRAPH_H
    26 
    27 #include <lemon/concepts/graph_components.h>
    28 
    29 #include <lemon/concepts/graph.h>
    30 #include <lemon/concepts/ugraph.h>
    31 
    32 #include <lemon/bits/utility.h>
    33 
    34 namespace lemon {
    35   namespace concepts {
    36 
    37     /// \addtogroup graph_concepts
    38     /// @{
    39 
    40 
    41     /// \brief Class describing the concept of Bipartite Undirected Graphs.
    42     ///
    43     /// This class describes the common interface of all 
    44     /// Undirected Bipartite Graphs.
    45     ///
    46     /// As all concept describing classes it provides only interface
    47     /// without any sensible implementation. So any algorithm for
    48     /// bipartite undirected graph should compile with this class, but it 
    49     /// will not run properly, of course.
    50     ///
    51     /// In LEMON bipartite undirected graphs also fulfill the concept of 
    52     /// the undirected graphs (\ref lemon::concepts::UGraph "UGraph Concept"). 
    53     ///
    54     /// You can assume that all undirected bipartite graph can be handled
    55     /// as an undirected graph and consequently as a static graph.
    56     ///
    57     /// The bipartite graph stores two types of nodes which are named
    58     /// ANode and BNode. The graph type contains two types ANode and
    59     /// BNode which are inherited from Node type. Moreover they have
    60     /// constructor which converts Node to either ANode or BNode when
    61     /// it is possible. Therefor everywhere the Node type can be used
    62     /// instead of ANode and BNode. So the usage of the ANode and
    63     /// BNode is not suggested.
    64     ///
    65     /// The iteration on the partition can be done with the ANodeIt and 
    66     /// BNodeIt classes. The node map can be used to map values to the nodes
    67     /// and similarly we can use to map values for just the ANodes and
    68     /// BNodes the ANodeMap and BNodeMap template classes.
    69 
    70     class BpUGraph {
    71     public:
    72       /// \brief The undirected graph should be tagged by the
    73       /// UndirectedTag.
    74       ///
    75       /// The undirected graph should be tagged by the UndirectedTag. This
    76       /// tag helps the enable_if technics to make compile time 
    77       /// specializations for undirected graphs.  
    78       typedef True UndirectedTag;
    79 
    80       /// \brief The base type of node iterators, 
    81       /// or in other words, the trivial node iterator.
    82       ///
    83       /// This is the base type of each node iterator,
    84       /// thus each kind of node iterator converts to this.
    85       /// More precisely each kind of node iterator should be inherited 
    86       /// from the trivial node iterator. The Node class represents
    87       /// both of two types of nodes. 
    88       class Node {
    89       public:
    90         /// Default constructor
    91 
    92         /// @warning The default constructor sets the iterator
    93         /// to an undefined value.
    94         Node() { }
    95         /// Copy constructor.
    96 
    97         /// Copy constructor.
    98         ///
    99         Node(const Node&) { }
   100 
   101         /// Invalid constructor \& conversion.
   102 
   103         /// This constructor initializes the iterator to be invalid.
   104         /// \sa Invalid for more details.
   105         Node(Invalid) { }
   106         /// Equality operator
   107 
   108         /// Two iterators are equal if and only if they point to the
   109         /// same object or both are invalid.
   110         bool operator==(Node) const { return true; }
   111 
   112         /// Inequality operator
   113         
   114         /// \sa operator==(Node n)
   115         ///
   116         bool operator!=(Node) const { return true; }
   117 
   118 	/// Artificial ordering operator.
   119 	
   120 	/// To allow the use of graph descriptors as key type in std::map or
   121 	/// similar associative container we require this.
   122 	///
   123 	/// \note This operator only have to define some strict ordering of
   124 	/// the items; this order has nothing to do with the iteration
   125 	/// ordering of the items.
   126 	bool operator<(Node) const { return false; }
   127 
   128       };
   129 
   130       /// \brief Helper class for ANodes.
   131       ///
   132       /// This class is just a helper class for ANodes, it is not
   133       /// suggested to use it directly. It can be converted easily to
   134       /// node and vice versa. The usage of this class is limited
   135       /// to use just as template parameters for special map types. 
   136       class ANode : public Node {
   137       public:
   138         /// Default constructor
   139 
   140         /// @warning The default constructor sets the iterator
   141         /// to an undefined value.
   142         ANode() : Node() { }
   143         /// Copy constructor.
   144 
   145         /// Copy constructor.
   146         ///
   147         ANode(const ANode&) : Node() { }
   148 
   149         /// Construct the same node as ANode.
   150 
   151         /// Construct the same node as ANode. It may throws assertion
   152         /// when the given node is from the BNode set.
   153         ANode(const Node&) : Node() { }
   154 
   155         /// Assign node to A-node.
   156 
   157         /// Besides the core graph item functionality each node should
   158         /// be convertible to the represented A-node if it is it possible. 
   159         ANode& operator=(const Node&) { return *this; }
   160 
   161         /// Invalid constructor \& conversion.
   162 
   163         /// This constructor initializes the iterator to be invalid.
   164         /// \sa Invalid for more details.
   165         ANode(Invalid) { }
   166         /// Equality operator
   167 
   168         /// Two iterators are equal if and only if they point to the
   169         /// same object or both are invalid.
   170         bool operator==(ANode) const { return true; }
   171 
   172         /// Inequality operator
   173         
   174         /// \sa operator==(ANode n)
   175         ///
   176         bool operator!=(ANode) const { return true; }
   177 
   178 	/// Artificial ordering operator.
   179 	
   180 	/// To allow the use of graph descriptors as key type in std::map or
   181 	/// similar associative container we require this.
   182 	///
   183 	/// \note This operator only have to define some strict ordering of
   184 	/// the items; this order has nothing to do with the iteration
   185 	/// ordering of the items.
   186 	bool operator<(ANode) const { return false; }
   187 
   188       };
   189 
   190       /// \brief Helper class for BNodes.
   191       ///
   192       /// This class is just a helper class for BNodes, it is not
   193       /// suggested to use it directly. It can be converted easily to
   194       /// node and vice versa. The usage of this class is limited
   195       /// to use just as template parameters for special map types. 
   196       class BNode : public Node {
   197       public:
   198         /// Default constructor
   199 
   200         /// @warning The default constructor sets the iterator
   201         /// to an undefined value.
   202         BNode() : Node() { }
   203         /// Copy constructor.
   204 
   205         /// Copy constructor.
   206         ///
   207         BNode(const BNode&) : Node() { }
   208 
   209         /// Construct the same node as BNode.
   210 
   211         /// Construct the same node as BNode. It may throws assertion
   212         /// when the given node is from the ANode set.
   213         BNode(const Node&) : Node() { }
   214 
   215         /// Assign node to B-node.
   216 
   217         /// Besides the core graph item functionality each node should
   218         /// be convertible to the represented B-node if it is it possible. 
   219         BNode& operator=(const Node&) { return *this; }
   220 
   221         /// Invalid constructor \& conversion.
   222 
   223         /// This constructor initializes the iterator to be invalid.
   224         /// \sa Invalid for more details.
   225         BNode(Invalid) { }
   226         /// Equality operator
   227 
   228         /// Two iterators are equal if and only if they point to the
   229         /// same object or both are invalid.
   230         bool operator==(BNode) const { return true; }
   231 
   232         /// Inequality operator
   233         
   234         /// \sa operator==(BNode n)
   235         ///
   236         bool operator!=(BNode) const { return true; }
   237 
   238 	/// Artificial ordering operator.
   239 	
   240 	/// To allow the use of graph descriptors as key type in std::map or
   241 	/// similar associative container we require this.
   242 	///
   243 	/// \note This operator only have to define some strict ordering of
   244 	/// the items; this order has nothing to do with the iteration
   245 	/// ordering of the items.
   246 	bool operator<(BNode) const { return false; }
   247 
   248       };
   249     
   250       /// This iterator goes through each node.
   251 
   252       /// This iterator goes through each node.
   253       /// Its usage is quite simple, for example you can count the number
   254       /// of nodes in graph \c g of type \c Graph like this:
   255       ///\code
   256       /// int count=0;
   257       /// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count;
   258       ///\endcode
   259       class NodeIt : public Node {
   260       public:
   261         /// Default constructor
   262 
   263         /// @warning The default constructor sets the iterator
   264         /// to an undefined value.
   265         NodeIt() { }
   266         /// Copy constructor.
   267         
   268         /// Copy constructor.
   269         ///
   270         NodeIt(const NodeIt& n) : Node(n) { }
   271         /// Invalid constructor \& conversion.
   272 
   273         /// Initialize the iterator to be invalid.
   274         /// \sa Invalid for more details.
   275         NodeIt(Invalid) { }
   276         /// Sets the iterator to the first node.
   277 
   278         /// Sets the iterator to the first node of \c g.
   279         ///
   280         NodeIt(const BpUGraph&) { }
   281         /// Node -> NodeIt conversion.
   282 
   283         /// Sets the iterator to the node of \c the graph pointed by 
   284 	/// the trivial iterator.
   285         /// This feature necessitates that each time we 
   286         /// iterate the edge-set, the iteration order is the same.
   287         NodeIt(const BpUGraph&, const Node&) { }
   288         /// Next node.
   289 
   290         /// Assign the iterator to the next node.
   291         ///
   292         NodeIt& operator++() { return *this; }
   293       };
   294 
   295       /// This iterator goes through each ANode.
   296 
   297       /// This iterator goes through each ANode.
   298       /// Its usage is quite simple, for example you can count the number
   299       /// of nodes in graph \c g of type \c Graph like this:
   300       ///\code
   301       /// int count=0;
   302       /// for (Graph::ANodeIt n(g); n!=INVALID; ++n) ++count;
   303       ///\endcode
   304       class ANodeIt : public Node {
   305       public:
   306         /// Default constructor
   307 
   308         /// @warning The default constructor sets the iterator
   309         /// to an undefined value.
   310         ANodeIt() { }
   311         /// Copy constructor.
   312         
   313         /// Copy constructor.
   314         ///
   315         ANodeIt(const ANodeIt& n) : Node(n) { }
   316         /// Invalid constructor \& conversion.
   317 
   318         /// Initialize the iterator to be invalid.
   319         /// \sa Invalid for more details.
   320         ANodeIt(Invalid) { }
   321         /// Sets the iterator to the first node.
   322 
   323         /// Sets the iterator to the first node of \c g.
   324         ///
   325         ANodeIt(const BpUGraph&) { }
   326         /// Node -> ANodeIt conversion.
   327 
   328         /// Sets the iterator to the node of \c the graph pointed by 
   329 	/// the trivial iterator.
   330         /// This feature necessitates that each time we 
   331         /// iterate the edge-set, the iteration order is the same.
   332         ANodeIt(const BpUGraph&, const Node&) { }
   333         /// Next node.
   334 
   335         /// Assign the iterator to the next node.
   336         ///
   337         ANodeIt& operator++() { return *this; }
   338       };
   339 
   340       /// This iterator goes through each BNode.
   341 
   342       /// This iterator goes through each BNode.
   343       /// Its usage is quite simple, for example you can count the number
   344       /// of nodes in graph \c g of type \c Graph like this:
   345       ///\code
   346       /// int count=0;
   347       /// for (Graph::BNodeIt n(g); n!=INVALID; ++n) ++count;
   348       ///\endcode
   349       class BNodeIt : public Node {
   350       public:
   351         /// Default constructor
   352 
   353         /// @warning The default constructor sets the iterator
   354         /// to an undefined value.
   355         BNodeIt() { }
   356         /// Copy constructor.
   357         
   358         /// Copy constructor.
   359         ///
   360         BNodeIt(const BNodeIt& n) : Node(n) { }
   361         /// Invalid constructor \& conversion.
   362 
   363         /// Initialize the iterator to be invalid.
   364         /// \sa Invalid for more details.
   365         BNodeIt(Invalid) { }
   366         /// Sets the iterator to the first node.
   367 
   368         /// Sets the iterator to the first node of \c g.
   369         ///
   370         BNodeIt(const BpUGraph&) { }
   371         /// Node -> BNodeIt conversion.
   372 
   373         /// Sets the iterator to the node of \c the graph pointed by 
   374 	/// the trivial iterator.
   375         /// This feature necessitates that each time we 
   376         /// iterate the edge-set, the iteration order is the same.
   377         BNodeIt(const BpUGraph&, const Node&) { }
   378         /// Next node.
   379 
   380         /// Assign the iterator to the next node.
   381         ///
   382         BNodeIt& operator++() { return *this; }
   383       };
   384     
   385     
   386       /// The base type of the undirected edge iterators.
   387 
   388       /// The base type of the undirected edge iterators.
   389       ///
   390       class UEdge {
   391       public:
   392         /// Default constructor
   393 
   394         /// @warning The default constructor sets the iterator
   395         /// to an undefined value.
   396         UEdge() { }
   397         /// Copy constructor.
   398 
   399         /// Copy constructor.
   400         ///
   401         UEdge(const UEdge&) { }
   402         /// Initialize the iterator to be invalid.
   403 
   404         /// Initialize the iterator to be invalid.
   405         ///
   406         UEdge(Invalid) { }
   407         /// Equality operator
   408 
   409         /// Two iterators are equal if and only if they point to the
   410         /// same object or both are invalid.
   411         bool operator==(UEdge) const { return true; }
   412         /// Inequality operator
   413 
   414         /// \sa operator==(UEdge n)
   415         ///
   416         bool operator!=(UEdge) const { return true; }
   417 
   418 	/// Artificial ordering operator.
   419 	
   420 	/// To allow the use of graph descriptors as key type in std::map or
   421 	/// similar associative container we require this.
   422 	///
   423 	/// \note This operator only have to define some strict ordering of
   424 	/// the items; this order has nothing to do with the iteration
   425 	/// ordering of the items.
   426 	bool operator<(UEdge) const { return false; }
   427       };
   428 
   429       /// This iterator goes through each undirected edge.
   430 
   431       /// This iterator goes through each undirected edge of a graph.
   432       /// Its usage is quite simple, for example you can count the number
   433       /// of undirected edges in a graph \c g of type \c Graph as follows:
   434       ///\code
   435       /// int count=0;
   436       /// for(Graph::UEdgeIt e(g); e!=INVALID; ++e) ++count;
   437       ///\endcode
   438       class UEdgeIt : public UEdge {
   439       public:
   440         /// Default constructor
   441 
   442         /// @warning The default constructor sets the iterator
   443         /// to an undefined value.
   444         UEdgeIt() { }
   445         /// Copy constructor.
   446 
   447         /// Copy constructor.
   448         ///
   449         UEdgeIt(const UEdgeIt& e) : UEdge(e) { }
   450         /// Initialize the iterator to be invalid.
   451 
   452         /// Initialize the iterator to be invalid.
   453         ///
   454         UEdgeIt(Invalid) { }
   455         /// This constructor sets the iterator to the first undirected edge.
   456     
   457         /// This constructor sets the iterator to the first undirected edge.
   458         UEdgeIt(const BpUGraph&) { }
   459         /// UEdge -> UEdgeIt conversion
   460 
   461         /// Sets the iterator to the value of the trivial iterator.
   462         /// This feature necessitates that each time we
   463         /// iterate the undirected edge-set, the iteration order is the 
   464 	/// same.
   465         UEdgeIt(const BpUGraph&, const UEdge&) { } 
   466         /// Next undirected edge
   467         
   468         /// Assign the iterator to the next undirected edge.
   469         UEdgeIt& operator++() { return *this; }
   470       };
   471 
   472       /// \brief This iterator goes trough the incident undirected 
   473       /// edges of a node.
   474       ///
   475       /// This iterator goes trough the incident undirected edges
   476       /// of a certain node
   477       /// of a graph.
   478       /// Its usage is quite simple, for example you can compute the
   479       /// degree (i.e. count the number
   480       /// of incident edges of a node \c n
   481       /// in graph \c g of type \c Graph as follows.
   482       ///\code
   483       /// int count=0;
   484       /// for(Graph::IncEdgeIt e(g, n); e!=INVALID; ++e) ++count;
   485       ///\endcode
   486       class IncEdgeIt : public UEdge {
   487       public:
   488         /// Default constructor
   489 
   490         /// @warning The default constructor sets the iterator
   491         /// to an undefined value.
   492         IncEdgeIt() { }
   493         /// Copy constructor.
   494 
   495         /// Copy constructor.
   496         ///
   497         IncEdgeIt(const IncEdgeIt& e) : UEdge(e) { }
   498         /// Initialize the iterator to be invalid.
   499 
   500         /// Initialize the iterator to be invalid.
   501         ///
   502         IncEdgeIt(Invalid) { }
   503         /// This constructor sets the iterator to first incident edge.
   504     
   505         /// This constructor set the iterator to the first incident edge of
   506         /// the node.
   507         IncEdgeIt(const BpUGraph&, const Node&) { }
   508         /// UEdge -> IncEdgeIt conversion
   509 
   510         /// Sets the iterator to the value of the trivial iterator \c e.
   511         /// This feature necessitates that each time we 
   512         /// iterate the edge-set, the iteration order is the same.
   513         IncEdgeIt(const BpUGraph&, const UEdge&) { }
   514         /// Next incident edge
   515 
   516         /// Assign the iterator to the next incident edge
   517 	/// of the corresponding node.
   518         IncEdgeIt& operator++() { return *this; }
   519       };
   520 
   521       /// The directed edge type.
   522 
   523       /// The directed edge type. It can be converted to the
   524       /// undirected edge.
   525       class Edge : public UEdge {
   526       public:
   527         /// Default constructor
   528 
   529         /// @warning The default constructor sets the iterator
   530         /// to an undefined value.
   531         Edge() { }
   532         /// Copy constructor.
   533 
   534         /// Copy constructor.
   535         ///
   536         Edge(const Edge& e) : UEdge(e) { }
   537         /// Initialize the iterator to be invalid.
   538 
   539         /// Initialize the iterator to be invalid.
   540         ///
   541         Edge(Invalid) { }
   542         /// Equality operator
   543 
   544         /// Two iterators are equal if and only if they point to the
   545         /// same object or both are invalid.
   546         bool operator==(Edge) const { return true; }
   547         /// Inequality operator
   548 
   549         /// \sa operator==(Edge n)
   550         ///
   551         bool operator!=(Edge) const { return true; }
   552 
   553 	/// Artificial ordering operator.
   554 	
   555 	/// To allow the use of graph descriptors as key type in std::map or
   556 	/// similar associative container we require this.
   557 	///
   558 	/// \note This operator only have to define some strict ordering of
   559 	/// the items; this order has nothing to do with the iteration
   560 	/// ordering of the items.
   561 	bool operator<(Edge) const { return false; }
   562 	
   563       }; 
   564       /// This iterator goes through each directed edge.
   565 
   566       /// This iterator goes through each edge of a graph.
   567       /// Its usage is quite simple, for example you can count the number
   568       /// of edges in a graph \c g of type \c Graph as follows:
   569       ///\code
   570       /// int count=0;
   571       /// for(Graph::EdgeIt e(g); e!=INVALID; ++e) ++count;
   572       ///\endcode
   573       class EdgeIt : public Edge {
   574       public:
   575         /// Default constructor
   576 
   577         /// @warning The default constructor sets the iterator
   578         /// to an undefined value.
   579         EdgeIt() { }
   580         /// Copy constructor.
   581 
   582         /// Copy constructor.
   583         ///
   584         EdgeIt(const EdgeIt& e) : Edge(e) { }
   585         /// Initialize the iterator to be invalid.
   586 
   587         /// Initialize the iterator to be invalid.
   588         ///
   589         EdgeIt(Invalid) { }
   590         /// This constructor sets the iterator to the first edge.
   591     
   592         /// This constructor sets the iterator to the first edge of \c g.
   593         ///@param g the graph
   594         EdgeIt(const BpUGraph &g) { ignore_unused_variable_warning(g); }
   595         /// Edge -> EdgeIt conversion
   596 
   597         /// Sets the iterator to the value of the trivial iterator \c e.
   598         /// This feature necessitates that each time we 
   599         /// iterate the edge-set, the iteration order is the same.
   600         EdgeIt(const BpUGraph&, const Edge&) { } 
   601         ///Next edge
   602         
   603         /// Assign the iterator to the next edge.
   604         EdgeIt& operator++() { return *this; }
   605       };
   606    
   607       /// This iterator goes trough the outgoing directed edges of a node.
   608 
   609       /// This iterator goes trough the \e outgoing edges of a certain node
   610       /// of a graph.
   611       /// Its usage is quite simple, for example you can count the number
   612       /// of outgoing edges of a node \c n
   613       /// in graph \c g of type \c Graph as follows.
   614       ///\code
   615       /// int count=0;
   616       /// for (Graph::OutEdgeIt e(g, n); e!=INVALID; ++e) ++count;
   617       ///\endcode
   618     
   619       class OutEdgeIt : public Edge {
   620       public:
   621         /// Default constructor
   622 
   623         /// @warning The default constructor sets the iterator
   624         /// to an undefined value.
   625         OutEdgeIt() { }
   626         /// Copy constructor.
   627 
   628         /// Copy constructor.
   629         ///
   630         OutEdgeIt(const OutEdgeIt& e) : Edge(e) { }
   631         /// Initialize the iterator to be invalid.
   632 
   633         /// Initialize the iterator to be invalid.
   634         ///
   635         OutEdgeIt(Invalid) { }
   636         /// This constructor sets the iterator to the first outgoing edge.
   637     
   638         /// This constructor sets the iterator to the first outgoing edge of
   639         /// the node.
   640         ///@param n the node
   641         ///@param g the graph
   642         OutEdgeIt(const BpUGraph& n, const Node& g) {
   643 	  ignore_unused_variable_warning(n);
   644 	  ignore_unused_variable_warning(g);
   645 	}
   646         /// Edge -> OutEdgeIt conversion
   647 
   648         /// Sets the iterator to the value of the trivial iterator.
   649 	/// This feature necessitates that each time we 
   650         /// iterate the edge-set, the iteration order is the same.
   651         OutEdgeIt(const BpUGraph&, const Edge&) { }
   652         ///Next outgoing edge
   653         
   654         /// Assign the iterator to the next 
   655         /// outgoing edge of the corresponding node.
   656         OutEdgeIt& operator++() { return *this; }
   657       };
   658 
   659       /// This iterator goes trough the incoming directed edges of a node.
   660 
   661       /// This iterator goes trough the \e incoming edges of a certain node
   662       /// of a graph.
   663       /// Its usage is quite simple, for example you can count the number
   664       /// of outgoing edges of a node \c n
   665       /// in graph \c g of type \c Graph as follows.
   666       ///\code
   667       /// int count=0;
   668       /// for(Graph::InEdgeIt e(g, n); e!=INVALID; ++e) ++count;
   669       ///\endcode
   670 
   671       class InEdgeIt : public Edge {
   672       public:
   673         /// Default constructor
   674 
   675         /// @warning The default constructor sets the iterator
   676         /// to an undefined value.
   677         InEdgeIt() { }
   678         /// Copy constructor.
   679 
   680         /// Copy constructor.
   681         ///
   682         InEdgeIt(const InEdgeIt& e) : Edge(e) { }
   683         /// Initialize the iterator to be invalid.
   684 
   685         /// Initialize the iterator to be invalid.
   686         ///
   687         InEdgeIt(Invalid) { }
   688         /// This constructor sets the iterator to first incoming edge.
   689     
   690         /// This constructor set the iterator to the first incoming edge of
   691         /// the node.
   692         ///@param n the node
   693         ///@param g the graph
   694         InEdgeIt(const BpUGraph& g, const Node& n) { 
   695 	  ignore_unused_variable_warning(n);
   696 	  ignore_unused_variable_warning(g);
   697 	}
   698         /// Edge -> InEdgeIt conversion
   699 
   700         /// Sets the iterator to the value of the trivial iterator \c e.
   701         /// This feature necessitates that each time we 
   702         /// iterate the edge-set, the iteration order is the same.
   703         InEdgeIt(const BpUGraph&, const Edge&) { }
   704         /// Next incoming edge
   705 
   706         /// Assign the iterator to the next inedge of the corresponding node.
   707         ///
   708         InEdgeIt& operator++() { return *this; }
   709       };
   710 
   711       /// \brief Read write map of the nodes to type \c T.
   712       /// 
   713       /// ReadWrite map of the nodes to type \c T.
   714       /// \sa Reference
   715       /// \todo Wrong documentation
   716       template<class T> 
   717       class NodeMap : public ReadWriteMap< Node, T >
   718       {
   719       public:
   720 
   721         ///\e
   722         NodeMap(const BpUGraph&) { }
   723         ///\e
   724         NodeMap(const BpUGraph&, T) { }
   725 
   726         ///Copy constructor
   727         NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
   728         ///Assignment operator
   729         NodeMap& operator=(const NodeMap&) { return *this; }
   730         ///Assignment operator
   731         template <typename CMap>
   732         NodeMap& operator=(const CMap&) { 
   733           checkConcept<ReadMap<Node, T>, CMap>();
   734           return *this; 
   735         }
   736       };
   737 
   738       /// \brief Read write map of the ANodes to type \c T.
   739       /// 
   740       /// ReadWrite map of the ANodes to type \c T.
   741       /// \sa Reference
   742       /// \todo Wrong documentation
   743       template<class T> 
   744       class ANodeMap : public ReadWriteMap< Node, T >
   745       {
   746       public:
   747 
   748         ///\e
   749         ANodeMap(const BpUGraph&) { }
   750         ///\e
   751         ANodeMap(const BpUGraph&, T) { }
   752 
   753         ///Copy constructor
   754         ANodeMap(const ANodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
   755         ///Assignment operator
   756         ANodeMap& operator=(const ANodeMap&) { return *this; }
   757         ///Assignment operator
   758         template <typename CMap>
   759         ANodeMap& operator=(const CMap&) { 
   760           checkConcept<ReadMap<Node, T>, CMap>();
   761           return *this; 
   762         }
   763       };
   764 
   765       /// \brief Read write map of the BNodes to type \c T.
   766       /// 
   767       /// ReadWrite map of the BNodes to type \c T.
   768       /// \sa Reference
   769       /// \todo Wrong documentation
   770       template<class T> 
   771       class BNodeMap : public ReadWriteMap< Node, T >
   772       {
   773       public:
   774 
   775         ///\e
   776         BNodeMap(const BpUGraph&) { }
   777         ///\e
   778         BNodeMap(const BpUGraph&, T) { }
   779 
   780         ///Copy constructor
   781         BNodeMap(const BNodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
   782         ///Assignment operator
   783         BNodeMap& operator=(const BNodeMap&) { return *this; }
   784         ///Assignment operator
   785         template <typename CMap>
   786         BNodeMap& operator=(const CMap&) { 
   787           checkConcept<ReadMap<Node, T>, CMap>();
   788           return *this; 
   789         }
   790       };
   791 
   792       /// \brief Read write map of the directed edges to type \c T.
   793       ///
   794       /// Reference map of the directed edges to type \c T.
   795       /// \sa Reference
   796       /// \todo Wrong documentation
   797       template<class T> 
   798       class EdgeMap : public ReadWriteMap<Edge,T>
   799       {
   800       public:
   801 
   802         ///\e
   803         EdgeMap(const BpUGraph&) { }
   804         ///\e
   805         EdgeMap(const BpUGraph&, T) { }
   806         ///Copy constructor
   807         EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) { }
   808         ///Assignment operator
   809         EdgeMap& operator=(const EdgeMap&) { return *this; }
   810         ///Assignment operator
   811         template <typename CMap>
   812         EdgeMap& operator=(const CMap&) { 
   813           checkConcept<ReadMap<Edge, T>, CMap>();
   814           return *this; 
   815         }
   816       };
   817 
   818       /// Read write map of the undirected edges to type \c T.
   819 
   820       /// Reference map of the edges to type \c T.
   821       /// \sa Reference
   822       /// \todo Wrong documentation
   823       template<class T> 
   824       class UEdgeMap : public ReadWriteMap<UEdge,T>
   825       {
   826       public:
   827 
   828         ///\e
   829         UEdgeMap(const BpUGraph&) { }
   830         ///\e
   831         UEdgeMap(const BpUGraph&, T) { }
   832         ///Copy constructor
   833         UEdgeMap(const UEdgeMap& em) : ReadWriteMap<UEdge,T>(em) {}
   834         ///Assignment operator
   835         UEdgeMap &operator=(const UEdgeMap&) { return *this; }
   836         ///Assignment operator
   837         template <typename CMap>
   838         UEdgeMap& operator=(const CMap&) { 
   839           checkConcept<ReadMap<UEdge, T>, CMap>();
   840           return *this; 
   841         }
   842       };
   843 
   844       /// \brief Direct the given undirected edge.
   845       ///
   846       /// Direct the given undirected edge. The returned edge source
   847       /// will be the given node.
   848       Edge direct(const UEdge&, const Node&) const {
   849 	return INVALID;
   850       }
   851 
   852       /// \brief Direct the given undirected edge.
   853       ///
   854       /// Direct the given undirected edge. The returned edge
   855       /// represents the given undirected edge and the direction comes
   856       /// from the given bool.  The source of the undirected edge and
   857       /// the directed edge is the same when the given bool is true.
   858       Edge direct(const UEdge&, bool) const {
   859 	return INVALID;
   860       }
   861 
   862       /// \brief Returns true when the given node is an ANode.
   863       ///
   864       /// Returns true when the given node is an ANode.
   865       bool aNode(Node) const { return true;}
   866 
   867       /// \brief Returns true when the given node is an BNode.
   868       ///
   869       /// Returns true when the given node is an BNode.
   870       bool bNode(Node) const { return true;}
   871 
   872       /// \brief Returns the edge's end node which is in the ANode set.
   873       ///
   874       /// Returns the edge's end node which is in the ANode set.
   875       Node aNode(UEdge) const { return INVALID;}
   876 
   877       /// \brief Returns the edge's end node which is in the BNode set.
   878       ///
   879       /// Returns the edge's end node which is in the BNode set.
   880       Node bNode(UEdge) const { return INVALID;}
   881 
   882       /// \brief Returns true if the edge has default orientation.
   883       ///
   884       /// Returns whether the given directed edge is same orientation as
   885       /// the corresponding undirected edge's default orientation.
   886       bool direction(Edge) const { return true; }
   887 
   888       /// \brief Returns the opposite directed edge.
   889       ///
   890       /// Returns the opposite directed edge.
   891       Edge oppositeEdge(Edge) const { return INVALID; }
   892 
   893       /// \brief Opposite node on an edge
   894       ///
   895       /// \return the opposite of the given Node on the given UEdge
   896       Node oppositeNode(Node, UEdge) const { return INVALID; }
   897 
   898       /// \brief First node of the undirected edge.
   899       ///
   900       /// \return the first node of the given UEdge.
   901       ///
   902       /// Naturally undirected edges don't have direction and thus
   903       /// don't have source and target node. But we use these two methods
   904       /// to query the two endnodes of the edge. The direction of the edge
   905       /// which arises this way is called the inherent direction of the
   906       /// undirected edge, and is used to define the "default" direction
   907       /// of the directed versions of the edges.
   908       /// \sa direction
   909       Node source(UEdge) const { return INVALID; }
   910 
   911       /// \brief Second node of the undirected edge.
   912       Node target(UEdge) const { return INVALID; }
   913 
   914       /// \brief Source node of the directed edge.
   915       Node source(Edge) const { return INVALID; }
   916 
   917       /// \brief Target node of the directed edge.
   918       Node target(Edge) const { return INVALID; }
   919 
   920       /// \brief Base node of the iterator
   921       ///
   922       /// Returns the base node (the source in this case) of the iterator
   923       Node baseNode(OutEdgeIt e) const {
   924 	return source(e);
   925       }
   926 
   927       /// \brief Running node of the iterator
   928       ///
   929       /// Returns the running node (the target in this case) of the
   930       /// iterator
   931       Node runningNode(OutEdgeIt e) const {
   932 	return target(e);
   933       }
   934 
   935       /// \brief Base node of the iterator
   936       ///
   937       /// Returns the base node (the target in this case) of the iterator
   938       Node baseNode(InEdgeIt e) const {
   939 	return target(e);
   940       }
   941       /// \brief Running node of the iterator
   942       ///
   943       /// Returns the running node (the source in this case) of the
   944       /// iterator
   945       Node runningNode(InEdgeIt e) const {
   946 	return source(e);
   947       }
   948 
   949       /// \brief Base node of the iterator
   950       ///
   951       /// Returns the base node of the iterator
   952       Node baseNode(IncEdgeIt) const {
   953 	return INVALID;
   954       }
   955       
   956       /// \brief Running node of the iterator
   957       ///
   958       /// Returns the running node of the iterator
   959       Node runningNode(IncEdgeIt) const {
   960 	return INVALID;
   961       }
   962 
   963       void first(Node&) const {}
   964       void next(Node&) const {}
   965 
   966       void first(Edge&) const {}
   967       void next(Edge&) const {}
   968 
   969       void first(UEdge&) const {}
   970       void next(UEdge&) const {}
   971 
   972       void firstANode(Node&) const {}
   973       void nextANode(Node&) const {}
   974 
   975       void firstBNode(Node&) const {}
   976       void nextBNode(Node&) const {}
   977 
   978       void firstIn(Edge&, const Node&) const {}
   979       void nextIn(Edge&) const {}
   980 
   981       void firstOut(Edge&, const Node&) const {}
   982       void nextOut(Edge&) const {}
   983 
   984       void firstInc(UEdge &, bool &, const Node &) const {}
   985       void nextInc(UEdge &, bool &) const {}
   986 
   987       void firstFromANode(UEdge&, const Node&) const {}
   988       void nextFromANode(UEdge&) const {}
   989 
   990       void firstFromBNode(UEdge&, const Node&) const {}
   991       void nextFromBNode(UEdge&) const {}
   992 
   993       template <typename Graph>
   994       struct Constraints {
   995 	void constraints() {
   996 	  checkConcept<IterableBpUGraphComponent<>, Graph>();
   997 	  checkConcept<MappableBpUGraphComponent<>, Graph>();
   998 	}
   999       };
  1000 
  1001     };
  1002 
  1003 
  1004     /// @}
  1005 
  1006   }
  1007 
  1008 }
  1009 
  1010 #endif