lemon/concepts/graph.h
changeset 57 c1acf0018c0a
child 61 d718974f1290
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/lemon/concepts/graph.h	Sun Jan 20 20:43:48 2008 +0100
     1.3 @@ -0,0 +1,702 @@
     1.4 +/* -*- C++ -*-
     1.5 + *
     1.6 + * This file is a part of LEMON, a generic C++ optimization library
     1.7 + *
     1.8 + * Copyright (C) 2003-2007
     1.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    1.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
    1.11 + *
    1.12 + * Permission to use, modify and distribute this software is granted
    1.13 + * provided that this copyright notice appears in all copies. For
    1.14 + * precise terms see the accompanying LICENSE file.
    1.15 + *
    1.16 + * This software is provided "AS IS" with no warranty of any kind,
    1.17 + * express or implied, and with no claim as to its suitability for any
    1.18 + * purpose.
    1.19 + *
    1.20 + */
    1.21 +
    1.22 +///\ingroup graph_concepts
    1.23 +///\file
    1.24 +///\brief The concept of Undirected Graphs.
    1.25 +
    1.26 +#ifndef LEMON_CONCEPT_GRAPH_H
    1.27 +#define LEMON_CONCEPT_GRAPH_H
    1.28 +
    1.29 +#include <lemon/concepts/graph_components.h>
    1.30 +#include <lemon/concepts/graph.h>
    1.31 +#include <lemon/bits/utility.h>
    1.32 +
    1.33 +namespace lemon {
    1.34 +  namespace concepts {
    1.35 +
    1.36 +    /// \ingroup graph_concepts
    1.37 +    ///
    1.38 +    /// \brief Class describing the concept of Undirected Graphs.
    1.39 +    ///
    1.40 +    /// This class describes the common interface of all Undirected
    1.41 +    /// Graphs.
    1.42 +    ///
    1.43 +    /// As all concept describing classes it provides only interface
    1.44 +    /// without any sensible implementation. So any algorithm for
    1.45 +    /// undirected graph should compile with this class, but it will not
    1.46 +    /// run properly, of course.
    1.47 +    ///
    1.48 +    /// The LEMON undirected graphs also fulfill the concept of
    1.49 +    /// directed graphs (\ref lemon::concepts::Digraph "Digraph
    1.50 +    /// Concept"). Each edges can be seen as two opposite
    1.51 +    /// directed arc and consequently the undirected graph can be
    1.52 +    /// seen as the direceted graph of these directed arcs. The
    1.53 +    /// Graph has the Edge inner class for the edges and
    1.54 +    /// the Arc type for the directed arcs. The Arc type is
    1.55 +    /// convertible to Edge or inherited from it so from a directed
    1.56 +    /// arc we can get the represented edge.
    1.57 +    ///
    1.58 +    /// In the sense of the LEMON each edge has a default
    1.59 +    /// direction (it should be in every computer implementation,
    1.60 +    /// because the order of edge's nodes defines an
    1.61 +    /// orientation). With the default orientation we can define that
    1.62 +    /// the directed arc is forward or backward directed. With the \c
    1.63 +    /// direction() and \c direct() function we can get the direction
    1.64 +    /// of the directed arc and we can direct an edge.
    1.65 +    ///
    1.66 +    /// The EdgeIt is an iterator for the edges. We can use
    1.67 +    /// the EdgeMap to map values for the edges. The InArcIt and
    1.68 +    /// OutArcIt iterates on the same edges but with opposite
    1.69 +    /// direction. The IncArcIt iterates also on the same edges
    1.70 +    /// as the OutArcIt and InArcIt but it is not convertible to Arc just
    1.71 +    /// to Edge.  
    1.72 +    class Graph {
    1.73 +    public:
    1.74 +      /// \brief The undirected graph should be tagged by the
    1.75 +      /// UndirectedTag.
    1.76 +      ///
    1.77 +      /// The undirected graph should be tagged by the UndirectedTag. This
    1.78 +      /// tag helps the enable_if technics to make compile time 
    1.79 +      /// specializations for undirected graphs.  
    1.80 +      typedef True UndirectedTag;
    1.81 +
    1.82 +      /// \brief The base type of node iterators, 
    1.83 +      /// or in other words, the trivial node iterator.
    1.84 +      ///
    1.85 +      /// This is the base type of each node iterator,
    1.86 +      /// thus each kind of node iterator converts to this.
    1.87 +      /// More precisely each kind of node iterator should be inherited 
    1.88 +      /// from the trivial node iterator.
    1.89 +      class Node {
    1.90 +      public:
    1.91 +        /// Default constructor
    1.92 +
    1.93 +        /// @warning The default constructor sets the iterator
    1.94 +        /// to an undefined value.
    1.95 +        Node() { }
    1.96 +        /// Copy constructor.
    1.97 +
    1.98 +        /// Copy constructor.
    1.99 +        ///
   1.100 +        Node(const Node&) { }
   1.101 +
   1.102 +        /// Invalid constructor \& conversion.
   1.103 +
   1.104 +        /// This constructor initializes the iterator to be invalid.
   1.105 +        /// \sa Invalid for more details.
   1.106 +        Node(Invalid) { }
   1.107 +        /// Equality operator
   1.108 +
   1.109 +        /// Two iterators are equal if and only if they point to the
   1.110 +        /// same object or both are invalid.
   1.111 +        bool operator==(Node) const { return true; }
   1.112 +
   1.113 +        /// Inequality operator
   1.114 +        
   1.115 +        /// \sa operator==(Node n)
   1.116 +        ///
   1.117 +        bool operator!=(Node) const { return true; }
   1.118 +
   1.119 +	/// Artificial ordering operator.
   1.120 +	
   1.121 +	/// To allow the use of graph descriptors as key type in std::map or
   1.122 +	/// similar associative container we require this.
   1.123 +	///
   1.124 +	/// \note This operator only have to define some strict ordering of
   1.125 +	/// the items; this order has nothing to do with the iteration
   1.126 +	/// ordering of the items.
   1.127 +	bool operator<(Node) const { return false; }
   1.128 +
   1.129 +      };
   1.130 +    
   1.131 +      /// This iterator goes through each node.
   1.132 +
   1.133 +      /// This iterator goes through each node.
   1.134 +      /// Its usage is quite simple, for example you can count the number
   1.135 +      /// of nodes in graph \c g of type \c Graph like this:
   1.136 +      ///\code
   1.137 +      /// int count=0;
   1.138 +      /// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count;
   1.139 +      ///\endcode
   1.140 +      class NodeIt : public Node {
   1.141 +      public:
   1.142 +        /// Default constructor
   1.143 +
   1.144 +        /// @warning The default constructor sets the iterator
   1.145 +        /// to an undefined value.
   1.146 +        NodeIt() { }
   1.147 +        /// Copy constructor.
   1.148 +        
   1.149 +        /// Copy constructor.
   1.150 +        ///
   1.151 +        NodeIt(const NodeIt& n) : Node(n) { }
   1.152 +        /// Invalid constructor \& conversion.
   1.153 +
   1.154 +        /// Initialize the iterator to be invalid.
   1.155 +        /// \sa Invalid for more details.
   1.156 +        NodeIt(Invalid) { }
   1.157 +        /// Sets the iterator to the first node.
   1.158 +
   1.159 +        /// Sets the iterator to the first node of \c g.
   1.160 +        ///
   1.161 +        NodeIt(const Graph&) { }
   1.162 +        /// Node -> NodeIt conversion.
   1.163 +
   1.164 +        /// Sets the iterator to the node of \c the graph pointed by 
   1.165 +	/// the trivial iterator.
   1.166 +        /// This feature necessitates that each time we 
   1.167 +        /// iterate the arc-set, the iteration order is the same.
   1.168 +        NodeIt(const Graph&, const Node&) { }
   1.169 +        /// Next node.
   1.170 +
   1.171 +        /// Assign the iterator to the next node.
   1.172 +        ///
   1.173 +        NodeIt& operator++() { return *this; }
   1.174 +      };
   1.175 +    
   1.176 +    
   1.177 +      /// The base type of the edge iterators.
   1.178 +
   1.179 +      /// The base type of the edge iterators.
   1.180 +      ///
   1.181 +      class Edge {
   1.182 +      public:
   1.183 +        /// Default constructor
   1.184 +
   1.185 +        /// @warning The default constructor sets the iterator
   1.186 +        /// to an undefined value.
   1.187 +        Edge() { }
   1.188 +        /// Copy constructor.
   1.189 +
   1.190 +        /// Copy constructor.
   1.191 +        ///
   1.192 +        Edge(const Edge&) { }
   1.193 +        /// Initialize the iterator to be invalid.
   1.194 +
   1.195 +        /// Initialize the iterator to be invalid.
   1.196 +        ///
   1.197 +        Edge(Invalid) { }
   1.198 +        /// Equality operator
   1.199 +
   1.200 +        /// Two iterators are equal if and only if they point to the
   1.201 +        /// same object or both are invalid.
   1.202 +        bool operator==(Edge) const { return true; }
   1.203 +        /// Inequality operator
   1.204 +
   1.205 +        /// \sa operator==(Edge n)
   1.206 +        ///
   1.207 +        bool operator!=(Edge) const { return true; }
   1.208 +
   1.209 +	/// Artificial ordering operator.
   1.210 +	
   1.211 +	/// To allow the use of graph descriptors as key type in std::map or
   1.212 +	/// similar associative container we require this.
   1.213 +	///
   1.214 +	/// \note This operator only have to define some strict ordering of
   1.215 +	/// the items; this order has nothing to do with the iteration
   1.216 +	/// ordering of the items.
   1.217 +	bool operator<(Edge) const { return false; }
   1.218 +      };
   1.219 +
   1.220 +      /// This iterator goes through each edge.
   1.221 +
   1.222 +      /// This iterator goes through each edge of a graph.
   1.223 +      /// Its usage is quite simple, for example you can count the number
   1.224 +      /// of edges in a graph \c g of type \c Graph as follows:
   1.225 +      ///\code
   1.226 +      /// int count=0;
   1.227 +      /// for(Graph::EdgeIt e(g); e!=INVALID; ++e) ++count;
   1.228 +      ///\endcode
   1.229 +      class EdgeIt : public Edge {
   1.230 +      public:
   1.231 +        /// Default constructor
   1.232 +
   1.233 +        /// @warning The default constructor sets the iterator
   1.234 +        /// to an undefined value.
   1.235 +        EdgeIt() { }
   1.236 +        /// Copy constructor.
   1.237 +
   1.238 +        /// Copy constructor.
   1.239 +        ///
   1.240 +        EdgeIt(const EdgeIt& e) : Edge(e) { }
   1.241 +        /// Initialize the iterator to be invalid.
   1.242 +
   1.243 +        /// Initialize the iterator to be invalid.
   1.244 +        ///
   1.245 +        EdgeIt(Invalid) { }
   1.246 +        /// This constructor sets the iterator to the first edge.
   1.247 +    
   1.248 +        /// This constructor sets the iterator to the first edge.
   1.249 +        EdgeIt(const Graph&) { }
   1.250 +        /// Edge -> EdgeIt conversion
   1.251 +
   1.252 +        /// Sets the iterator to the value of the trivial iterator.
   1.253 +        /// This feature necessitates that each time we
   1.254 +        /// iterate the edge-set, the iteration order is the 
   1.255 +	/// same.
   1.256 +        EdgeIt(const Graph&, const Edge&) { } 
   1.257 +        /// Next edge
   1.258 +        
   1.259 +        /// Assign the iterator to the next edge.
   1.260 +        EdgeIt& operator++() { return *this; }
   1.261 +      };
   1.262 +
   1.263 +      /// \brief This iterator goes trough the incident undirected 
   1.264 +      /// arcs of a node.
   1.265 +      ///
   1.266 +      /// This iterator goes trough the incident edges
   1.267 +      /// of a certain node of a graph. You should assume that the 
   1.268 +      /// loop arcs will be iterated twice.
   1.269 +      /// 
   1.270 +      /// Its usage is quite simple, for example you can compute the
   1.271 +      /// degree (i.e. count the number of incident arcs of a node \c n
   1.272 +      /// in graph \c g of type \c Graph as follows. 
   1.273 +      ///
   1.274 +      ///\code
   1.275 +      /// int count=0;
   1.276 +      /// for(Graph::IncArcIt e(g, n); e!=INVALID; ++e) ++count;
   1.277 +      ///\endcode
   1.278 +      class IncArcIt : public Edge {
   1.279 +      public:
   1.280 +        /// Default constructor
   1.281 +
   1.282 +        /// @warning The default constructor sets the iterator
   1.283 +        /// to an undefined value.
   1.284 +        IncArcIt() { }
   1.285 +        /// Copy constructor.
   1.286 +
   1.287 +        /// Copy constructor.
   1.288 +        ///
   1.289 +        IncArcIt(const IncArcIt& e) : Edge(e) { }
   1.290 +        /// Initialize the iterator to be invalid.
   1.291 +
   1.292 +        /// Initialize the iterator to be invalid.
   1.293 +        ///
   1.294 +        IncArcIt(Invalid) { }
   1.295 +        /// This constructor sets the iterator to first incident arc.
   1.296 +    
   1.297 +        /// This constructor set the iterator to the first incident arc of
   1.298 +        /// the node.
   1.299 +        IncArcIt(const Graph&, const Node&) { }
   1.300 +        /// Edge -> IncArcIt conversion
   1.301 +
   1.302 +        /// Sets the iterator to the value of the trivial iterator \c e.
   1.303 +        /// This feature necessitates that each time we 
   1.304 +        /// iterate the arc-set, the iteration order is the same.
   1.305 +        IncArcIt(const Graph&, const Edge&) { }
   1.306 +        /// Next incident arc
   1.307 +
   1.308 +        /// Assign the iterator to the next incident arc
   1.309 +	/// of the corresponding node.
   1.310 +        IncArcIt& operator++() { return *this; }
   1.311 +      };
   1.312 +
   1.313 +      /// The directed arc type.
   1.314 +
   1.315 +      /// The directed arc type. It can be converted to the
   1.316 +      /// edge or it should be inherited from the undirected
   1.317 +      /// arc.
   1.318 +      class Arc : public Edge {
   1.319 +      public:
   1.320 +        /// Default constructor
   1.321 +
   1.322 +        /// @warning The default constructor sets the iterator
   1.323 +        /// to an undefined value.
   1.324 +        Arc() { }
   1.325 +        /// Copy constructor.
   1.326 +
   1.327 +        /// Copy constructor.
   1.328 +        ///
   1.329 +        Arc(const Arc& e) : Edge(e) { }
   1.330 +        /// Initialize the iterator to be invalid.
   1.331 +
   1.332 +        /// Initialize the iterator to be invalid.
   1.333 +        ///
   1.334 +        Arc(Invalid) { }
   1.335 +        /// Equality operator
   1.336 +
   1.337 +        /// Two iterators are equal if and only if they point to the
   1.338 +        /// same object or both are invalid.
   1.339 +        bool operator==(Arc) const { return true; }
   1.340 +        /// Inequality operator
   1.341 +
   1.342 +        /// \sa operator==(Arc n)
   1.343 +        ///
   1.344 +        bool operator!=(Arc) const { return true; }
   1.345 +
   1.346 +	/// Artificial ordering operator.
   1.347 +	
   1.348 +	/// To allow the use of graph descriptors as key type in std::map or
   1.349 +	/// similar associative container we require this.
   1.350 +	///
   1.351 +	/// \note This operator only have to define some strict ordering of
   1.352 +	/// the items; this order has nothing to do with the iteration
   1.353 +	/// ordering of the items.
   1.354 +	bool operator<(Arc) const { return false; }
   1.355 +	
   1.356 +      }; 
   1.357 +      /// This iterator goes through each directed arc.
   1.358 +
   1.359 +      /// This iterator goes through each arc of a graph.
   1.360 +      /// Its usage is quite simple, for example you can count the number
   1.361 +      /// of arcs in a graph \c g of type \c Graph as follows:
   1.362 +      ///\code
   1.363 +      /// int count=0;
   1.364 +      /// for(Graph::ArcIt e(g); e!=INVALID; ++e) ++count;
   1.365 +      ///\endcode
   1.366 +      class ArcIt : public Arc {
   1.367 +      public:
   1.368 +        /// Default constructor
   1.369 +
   1.370 +        /// @warning The default constructor sets the iterator
   1.371 +        /// to an undefined value.
   1.372 +        ArcIt() { }
   1.373 +        /// Copy constructor.
   1.374 +
   1.375 +        /// Copy constructor.
   1.376 +        ///
   1.377 +        ArcIt(const ArcIt& e) : Arc(e) { }
   1.378 +        /// Initialize the iterator to be invalid.
   1.379 +
   1.380 +        /// Initialize the iterator to be invalid.
   1.381 +        ///
   1.382 +        ArcIt(Invalid) { }
   1.383 +        /// This constructor sets the iterator to the first arc.
   1.384 +    
   1.385 +        /// This constructor sets the iterator to the first arc of \c g.
   1.386 +        ///@param g the graph
   1.387 +        ArcIt(const Graph &g) { ignore_unused_variable_warning(g); }
   1.388 +        /// Arc -> ArcIt conversion
   1.389 +
   1.390 +        /// Sets the iterator to the value of the trivial iterator \c e.
   1.391 +        /// This feature necessitates that each time we 
   1.392 +        /// iterate the arc-set, the iteration order is the same.
   1.393 +        ArcIt(const Graph&, const Arc&) { } 
   1.394 +        ///Next arc
   1.395 +        
   1.396 +        /// Assign the iterator to the next arc.
   1.397 +        ArcIt& operator++() { return *this; }
   1.398 +      };
   1.399 +   
   1.400 +      /// This iterator goes trough the outgoing directed arcs of a node.
   1.401 +
   1.402 +      /// This iterator goes trough the \e outgoing arcs of a certain node
   1.403 +      /// of a graph.
   1.404 +      /// Its usage is quite simple, for example you can count the number
   1.405 +      /// of outgoing arcs of a node \c n
   1.406 +      /// in graph \c g of type \c Graph as follows.
   1.407 +      ///\code
   1.408 +      /// int count=0;
   1.409 +      /// for (Graph::OutArcIt e(g, n); e!=INVALID; ++e) ++count;
   1.410 +      ///\endcode
   1.411 +    
   1.412 +      class OutArcIt : public Arc {
   1.413 +      public:
   1.414 +        /// Default constructor
   1.415 +
   1.416 +        /// @warning The default constructor sets the iterator
   1.417 +        /// to an undefined value.
   1.418 +        OutArcIt() { }
   1.419 +        /// Copy constructor.
   1.420 +
   1.421 +        /// Copy constructor.
   1.422 +        ///
   1.423 +        OutArcIt(const OutArcIt& e) : Arc(e) { }
   1.424 +        /// Initialize the iterator to be invalid.
   1.425 +
   1.426 +        /// Initialize the iterator to be invalid.
   1.427 +        ///
   1.428 +        OutArcIt(Invalid) { }
   1.429 +        /// This constructor sets the iterator to the first outgoing arc.
   1.430 +    
   1.431 +        /// This constructor sets the iterator to the first outgoing arc of
   1.432 +        /// the node.
   1.433 +        ///@param n the node
   1.434 +        ///@param g the graph
   1.435 +        OutArcIt(const Graph& n, const Node& g) {
   1.436 +	  ignore_unused_variable_warning(n);
   1.437 +	  ignore_unused_variable_warning(g);
   1.438 +	}
   1.439 +        /// Arc -> OutArcIt conversion
   1.440 +
   1.441 +        /// Sets the iterator to the value of the trivial iterator.
   1.442 +	/// This feature necessitates that each time we 
   1.443 +        /// iterate the arc-set, the iteration order is the same.
   1.444 +        OutArcIt(const Graph&, const Arc&) { }
   1.445 +        ///Next outgoing arc
   1.446 +        
   1.447 +        /// Assign the iterator to the next 
   1.448 +        /// outgoing arc of the corresponding node.
   1.449 +        OutArcIt& operator++() { return *this; }
   1.450 +      };
   1.451 +
   1.452 +      /// This iterator goes trough the incoming directed arcs of a node.
   1.453 +
   1.454 +      /// This iterator goes trough the \e incoming arcs of a certain node
   1.455 +      /// of a graph.
   1.456 +      /// Its usage is quite simple, for example you can count the number
   1.457 +      /// of outgoing arcs of a node \c n
   1.458 +      /// in graph \c g of type \c Graph as follows.
   1.459 +      ///\code
   1.460 +      /// int count=0;
   1.461 +      /// for(Graph::InArcIt e(g, n); e!=INVALID; ++e) ++count;
   1.462 +      ///\endcode
   1.463 +
   1.464 +      class InArcIt : public Arc {
   1.465 +      public:
   1.466 +        /// Default constructor
   1.467 +
   1.468 +        /// @warning The default constructor sets the iterator
   1.469 +        /// to an undefined value.
   1.470 +        InArcIt() { }
   1.471 +        /// Copy constructor.
   1.472 +
   1.473 +        /// Copy constructor.
   1.474 +        ///
   1.475 +        InArcIt(const InArcIt& e) : Arc(e) { }
   1.476 +        /// Initialize the iterator to be invalid.
   1.477 +
   1.478 +        /// Initialize the iterator to be invalid.
   1.479 +        ///
   1.480 +        InArcIt(Invalid) { }
   1.481 +        /// This constructor sets the iterator to first incoming arc.
   1.482 +    
   1.483 +        /// This constructor set the iterator to the first incoming arc of
   1.484 +        /// the node.
   1.485 +        ///@param n the node
   1.486 +        ///@param g the graph
   1.487 +        InArcIt(const Graph& g, const Node& n) { 
   1.488 +	  ignore_unused_variable_warning(n);
   1.489 +	  ignore_unused_variable_warning(g);
   1.490 +	}
   1.491 +        /// Arc -> InArcIt conversion
   1.492 +
   1.493 +        /// Sets the iterator to the value of the trivial iterator \c e.
   1.494 +        /// This feature necessitates that each time we 
   1.495 +        /// iterate the arc-set, the iteration order is the same.
   1.496 +        InArcIt(const Graph&, const Arc&) { }
   1.497 +        /// Next incoming arc
   1.498 +
   1.499 +        /// Assign the iterator to the next inarc of the corresponding node.
   1.500 +        ///
   1.501 +        InArcIt& operator++() { return *this; }
   1.502 +      };
   1.503 +
   1.504 +      /// \brief Read write map of the nodes to type \c T.
   1.505 +      /// 
   1.506 +      /// ReadWrite map of the nodes to type \c T.
   1.507 +      /// \sa Reference
   1.508 +      template<class T> 
   1.509 +      class NodeMap : public ReadWriteMap< Node, T >
   1.510 +      {
   1.511 +      public:
   1.512 +
   1.513 +        ///\e
   1.514 +        NodeMap(const Graph&) { }
   1.515 +        ///\e
   1.516 +        NodeMap(const Graph&, T) { }
   1.517 +
   1.518 +        ///Copy constructor
   1.519 +        NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
   1.520 +        ///Assignment operator
   1.521 +        template <typename CMap>
   1.522 +        NodeMap& operator=(const CMap&) { 
   1.523 +          checkConcept<ReadMap<Node, T>, CMap>();
   1.524 +          return *this; 
   1.525 +        }
   1.526 +      };
   1.527 +
   1.528 +      /// \brief Read write map of the directed arcs to type \c T.
   1.529 +      ///
   1.530 +      /// Reference map of the directed arcs to type \c T.
   1.531 +      /// \sa Reference
   1.532 +      template<class T> 
   1.533 +      class ArcMap : public ReadWriteMap<Arc,T>
   1.534 +      {
   1.535 +      public:
   1.536 +
   1.537 +        ///\e
   1.538 +        ArcMap(const Graph&) { }
   1.539 +        ///\e
   1.540 +        ArcMap(const Graph&, T) { }
   1.541 +        ///Copy constructor
   1.542 +        ArcMap(const ArcMap& em) : ReadWriteMap<Arc,T>(em) { }
   1.543 +        ///Assignment operator
   1.544 +        template <typename CMap>
   1.545 +        ArcMap& operator=(const CMap&) { 
   1.546 +          checkConcept<ReadMap<Arc, T>, CMap>();
   1.547 +          return *this; 
   1.548 +        }
   1.549 +      };
   1.550 +
   1.551 +      /// Read write map of the edges to type \c T.
   1.552 +
   1.553 +      /// Reference map of the arcs to type \c T.
   1.554 +      /// \sa Reference
   1.555 +      template<class T> 
   1.556 +      class EdgeMap : public ReadWriteMap<Edge,T>
   1.557 +      {
   1.558 +      public:
   1.559 +
   1.560 +        ///\e
   1.561 +        EdgeMap(const Graph&) { }
   1.562 +        ///\e
   1.563 +        EdgeMap(const Graph&, T) { }
   1.564 +        ///Copy constructor
   1.565 +        EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) {}
   1.566 +        ///Assignment operator
   1.567 +        template <typename CMap>
   1.568 +        EdgeMap& operator=(const CMap&) { 
   1.569 +          checkConcept<ReadMap<Edge, T>, CMap>();
   1.570 +          return *this; 
   1.571 +        }
   1.572 +      };
   1.573 +
   1.574 +      /// \brief Direct the given edge.
   1.575 +      ///
   1.576 +      /// Direct the given edge. The returned arc source
   1.577 +      /// will be the given node.
   1.578 +      Arc direct(const Edge&, const Node&) const {
   1.579 +	return INVALID;
   1.580 +      }
   1.581 +
   1.582 +      /// \brief Direct the given edge.
   1.583 +      ///
   1.584 +      /// Direct the given edge. The returned arc
   1.585 +      /// represents the given edge and the direction comes
   1.586 +      /// from the bool parameter. The source of the edge and
   1.587 +      /// the directed arc is the same when the given bool is true.
   1.588 +      Arc direct(const Edge&, bool) const {
   1.589 +	return INVALID;
   1.590 +      }
   1.591 +
   1.592 +      /// \brief Returns true if the arc has default orientation.
   1.593 +      ///
   1.594 +      /// Returns whether the given directed arc is same orientation as
   1.595 +      /// the corresponding edge's default orientation.
   1.596 +      bool direction(Arc) const { return true; }
   1.597 +
   1.598 +      /// \brief Returns the opposite directed arc.
   1.599 +      ///
   1.600 +      /// Returns the opposite directed arc.
   1.601 +      Arc oppositeArc(Arc) const { return INVALID; }
   1.602 +
   1.603 +      /// \brief Opposite node on an arc
   1.604 +      ///
   1.605 +      /// \return the opposite of the given Node on the given Edge
   1.606 +      Node oppositeNode(Node, Edge) const { return INVALID; }
   1.607 +
   1.608 +      /// \brief First node of the edge.
   1.609 +      ///
   1.610 +      /// \return the first node of the given Edge.
   1.611 +      ///
   1.612 +      /// Naturally edges don't have direction and thus
   1.613 +      /// don't have source and target node. But we use these two methods
   1.614 +      /// to query the two nodes of the arc. The direction of the arc
   1.615 +      /// which arises this way is called the inherent direction of the
   1.616 +      /// edge, and is used to define the "default" direction
   1.617 +      /// of the directed versions of the arcs.
   1.618 +      /// \sa direction
   1.619 +      Node u(Edge) const { return INVALID; }
   1.620 +
   1.621 +      /// \brief Second node of the edge.
   1.622 +      Node v(Edge) const { return INVALID; }
   1.623 +
   1.624 +      /// \brief Source node of the directed arc.
   1.625 +      Node source(Arc) const { return INVALID; }
   1.626 +
   1.627 +      /// \brief Target node of the directed arc.
   1.628 +      Node target(Arc) const { return INVALID; }
   1.629 +
   1.630 +      void first(Node&) const {}
   1.631 +      void next(Node&) const {}
   1.632 +
   1.633 +      void first(Edge&) const {}
   1.634 +      void next(Edge&) const {}
   1.635 +
   1.636 +      void first(Arc&) const {}
   1.637 +      void next(Arc&) const {}
   1.638 +
   1.639 +      void firstOut(Arc&, Node) const {}
   1.640 +      void nextOut(Arc&) const {}
   1.641 +
   1.642 +      void firstIn(Arc&, Node) const {}
   1.643 +      void nextIn(Arc&) const {}
   1.644 +
   1.645 +
   1.646 +      void firstInc(Edge &, bool &, const Node &) const {}
   1.647 +      void nextInc(Edge &, bool &) const {}
   1.648 +
   1.649 +      /// \brief Base node of the iterator
   1.650 +      ///
   1.651 +      /// Returns the base node (the source in this case) of the iterator
   1.652 +      Node baseNode(OutArcIt e) const {
   1.653 +	return source(e);
   1.654 +      }
   1.655 +      /// \brief Running node of the iterator
   1.656 +      ///
   1.657 +      /// Returns the running node (the target in this case) of the
   1.658 +      /// iterator
   1.659 +      Node runningNode(OutArcIt e) const {
   1.660 +	return target(e);
   1.661 +      }
   1.662 +
   1.663 +      /// \brief Base node of the iterator
   1.664 +      ///
   1.665 +      /// Returns the base node (the target in this case) of the iterator
   1.666 +      Node baseNode(InArcIt e) const {
   1.667 +	return target(e);
   1.668 +      }
   1.669 +      /// \brief Running node of the iterator
   1.670 +      ///
   1.671 +      /// Returns the running node (the source in this case) of the
   1.672 +      /// iterator
   1.673 +      Node runningNode(InArcIt e) const {
   1.674 +	return source(e);
   1.675 +      }
   1.676 +
   1.677 +      /// \brief Base node of the iterator
   1.678 +      ///
   1.679 +      /// Returns the base node of the iterator
   1.680 +      Node baseNode(IncArcIt) const {
   1.681 +	return INVALID;
   1.682 +      }
   1.683 +      
   1.684 +      /// \brief Running node of the iterator
   1.685 +      ///
   1.686 +      /// Returns the running node of the iterator
   1.687 +      Node runningNode(IncArcIt) const {
   1.688 +	return INVALID;
   1.689 +      }
   1.690 +
   1.691 +      template <typename Graph>
   1.692 +      struct Constraints {
   1.693 +	void constraints() {
   1.694 +	  checkConcept<IterableGraphComponent<>, Graph>();
   1.695 +	  checkConcept<MappableGraphComponent<>, Graph>();
   1.696 +	}
   1.697 +      };
   1.698 +
   1.699 +    };
   1.700 +
   1.701 +  }
   1.702 +
   1.703 +}
   1.704 +
   1.705 +#endif