src/lemon/concept/graph.h
changeset 1426 91eb70983697
parent 1367 a490662291b9
     1.1 --- a/src/lemon/concept/graph.h	Mon May 16 21:49:35 2005 +0000
     1.2 +++ b/src/lemon/concept/graph.h	Wed May 18 09:39:06 2005 +0000
     1.3 @@ -36,61 +36,61 @@
     1.4      /**************** The full-featured graph concepts ****************/
     1.5  
     1.6  
     1.7 -    /// \brief Modular builded static graph class.
     1.8 +    /// \brief Modular static graph class.
     1.9      ///     
    1.10      /// It should be the same as the \c StaticGraph class.
    1.11      class _StaticGraph 
    1.12        :  virtual public BaseGraphComponent,
    1.13 -	 public IterableGraphComponent, public MappableGraphComponent {
    1.14 +         public IterableGraphComponent, public MappableGraphComponent {
    1.15      public:
    1.16        typedef BaseGraphComponent::Node Node;
    1.17        typedef BaseGraphComponent::Edge Edge;
    1.18  
    1.19        template <typename _Graph>
    1.20        struct Constraints {
    1.21 -	void constraints() {
    1.22 -	  checkConcept<IterableGraphComponent, _Graph>();
    1.23 -	  checkConcept<MappableGraphComponent, _Graph>();
    1.24 -	}
    1.25 +        void constraints() {
    1.26 +          checkConcept<IterableGraphComponent, _Graph>();
    1.27 +          checkConcept<MappableGraphComponent, _Graph>();
    1.28 +        }
    1.29        };
    1.30      };
    1.31  
    1.32 -    /// \brief Modular builded extendable graph class.
    1.33 +    /// \brief Modular extendable graph class.
    1.34      ///     
    1.35      /// It should be the same as the \c ExtendableGraph class.
    1.36      class _ExtendableGraph 
    1.37        :  virtual public BaseGraphComponent, public _StaticGraph,
    1.38 -	 public ExtendableGraphComponent, public ClearableGraphComponent {
    1.39 +         public ExtendableGraphComponent, public ClearableGraphComponent {
    1.40      public:
    1.41        typedef BaseGraphComponent::Node Node;
    1.42        typedef BaseGraphComponent::Edge Edge;
    1.43  
    1.44        template <typename _Graph>
    1.45        struct Constraints {
    1.46 -	void constraints() {
    1.47 -	  checkConcept<_StaticGraph, _Graph >();
    1.48 -	  checkConcept<ExtendableGraphComponent, _Graph >();
    1.49 -	  checkConcept<ClearableGraphComponent, _Graph >();
    1.50 -	}
    1.51 +        void constraints() {
    1.52 +          checkConcept<_StaticGraph, _Graph >();
    1.53 +          checkConcept<ExtendableGraphComponent, _Graph >();
    1.54 +          checkConcept<ClearableGraphComponent, _Graph >();
    1.55 +        }
    1.56        };
    1.57      };
    1.58  
    1.59 -    /// \brief Modular builded erasable graph class.
    1.60 +    /// \brief Modular erasable graph class.
    1.61      ///     
    1.62      /// It should be the same as the \c ErasableGraph class.
    1.63      class _ErasableGraph 
    1.64        :  virtual public BaseGraphComponent, public _ExtendableGraph,
    1.65 -	 public ErasableGraphComponent {
    1.66 +         public ErasableGraphComponent {
    1.67      public:
    1.68        typedef BaseGraphComponent::Node Node;
    1.69        typedef BaseGraphComponent::Edge Edge;
    1.70  
    1.71        template <typename _Graph>
    1.72        struct Constraints {
    1.73 -	void constraints() {
    1.74 -	  checkConcept<_ExtendableGraph, _Graph >();
    1.75 -	  checkConcept<ErasableGraphComponent, _Graph >();
    1.76 -	}
    1.77 +        void constraints() {
    1.78 +          checkConcept<_ExtendableGraph, _Graph >();
    1.79 +          checkConcept<ErasableGraphComponent, _Graph >();
    1.80 +        }
    1.81        };
    1.82      };
    1.83  
    1.84 @@ -135,33 +135,33 @@
    1.85        /// from the trivial node iterator.
    1.86        class Node {
    1.87        public:
    1.88 -	/// Default constructor
    1.89 +        /// Default constructor
    1.90  
    1.91 -	/// @warning The default constructor sets the iterator
    1.92 -	/// to an undefined value.
    1.93 -	Node() { }
    1.94 -	/// Copy constructor.
    1.95 +        /// @warning The default constructor sets the iterator
    1.96 +        /// to an undefined value.
    1.97 +        Node() { }
    1.98 +        /// Copy constructor.
    1.99  
   1.100 -	/// Copy constructor.
   1.101 -	///
   1.102 -	Node(const Node&) { }
   1.103 +        /// Copy constructor.
   1.104 +        ///
   1.105 +        Node(const Node&) { }
   1.106  
   1.107 -	/// Invalid constructor \& conversion.
   1.108 +        /// Invalid constructor \& conversion.
   1.109  
   1.110 -	/// This constructor initializes the iterator to be invalid.
   1.111 -	/// \sa Invalid for more details.
   1.112 -	Node(Invalid) { }
   1.113 -	/// Equality operator
   1.114 +        /// This constructor initializes the iterator to be invalid.
   1.115 +        /// \sa Invalid for more details.
   1.116 +        Node(Invalid) { }
   1.117 +        /// Equality operator
   1.118  
   1.119 -	/// Two iterators are equal if and only if they point to the
   1.120 -	/// same object or both are invalid.
   1.121 -	bool operator==(Node) const { return true; }
   1.122 +        /// Two iterators are equal if and only if they point to the
   1.123 +        /// same object or both are invalid.
   1.124 +        bool operator==(Node) const { return true; }
   1.125  
   1.126 -	/// Inequality operator
   1.127 -	
   1.128 -	/// \sa operator==(Node n)
   1.129 -	///
   1.130 -	bool operator!=(Node) const { return true; }
   1.131 +        /// Inequality operator
   1.132 +        
   1.133 +        /// \sa operator==(Node n)
   1.134 +        ///
   1.135 +        bool operator!=(Node) const { return true; }
   1.136  
   1.137        };
   1.138      
   1.139 @@ -172,42 +172,42 @@
   1.140        /// of nodes in graph \c g of type \c Graph like this:
   1.141        /// \code
   1.142        /// int count=0;
   1.143 -      /// for (Graph::NodeIt n(g); n!=INVALID ++n) ++count;
   1.144 +      /// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count;
   1.145        /// \endcode
   1.146        class NodeIt : public Node {
   1.147        public:
   1.148 -	/// Default constructor
   1.149 +        /// Default constructor
   1.150  
   1.151 -	/// @warning The default constructor sets the iterator
   1.152 -	/// to an undefined value.
   1.153 -	NodeIt() { }
   1.154 -	/// Copy constructor.
   1.155 -	
   1.156 -	/// Copy constructor.
   1.157 -	///
   1.158 -	NodeIt(const NodeIt& n) : Node(n) { }
   1.159 -	/// Invalid constructor \& conversion.
   1.160 +        /// @warning The default constructor sets the iterator
   1.161 +        /// to an undefined value.
   1.162 +        NodeIt() { }
   1.163 +        /// Copy constructor.
   1.164 +        
   1.165 +        /// Copy constructor.
   1.166 +        ///
   1.167 +        NodeIt(const NodeIt& n) : Node(n) { }
   1.168 +        /// Invalid constructor \& conversion.
   1.169  
   1.170 -	/// Initialize the iterator to be invalid.
   1.171 -	/// \sa Invalid for more details.
   1.172 -	NodeIt(Invalid) { }
   1.173 -	/// Sets the iterator to the first node.
   1.174 +        /// Initialize the iterator to be invalid.
   1.175 +        /// \sa Invalid for more details.
   1.176 +        NodeIt(Invalid) { }
   1.177 +        /// Sets the iterator to the first node.
   1.178  
   1.179 -	/// Sets the iterator to the first node of \c g.
   1.180 -	///
   1.181 -	NodeIt(const StaticGraph&) { }
   1.182 -	/// Node -> NodeIt conversion.
   1.183 +        /// Sets the iterator to the first node of \c g.
   1.184 +        ///
   1.185 +        NodeIt(const StaticGraph&) { }
   1.186 +        /// Node -> NodeIt conversion.
   1.187  
   1.188 -	/// Sets the iterator to the node of \c g pointed by the trivial 
   1.189 -	/// iterator n.
   1.190 -	/// This feature necessitates that each time we 
   1.191 -	/// iterate the edge-set, the iteration order is the same.
   1.192 -	NodeIt(const StaticGraph& g, const Node& n) { }
   1.193 -	/// Next node.
   1.194 +        /// Sets the iterator to the node of \c g pointed by the trivial 
   1.195 +        /// iterator n.
   1.196 +        /// This feature necessitates that each time we 
   1.197 +        /// iterate the edge-set, the iteration order is the same.
   1.198 +        NodeIt(const StaticGraph& g, const Node& n) { }
   1.199 +        /// Next node.
   1.200  
   1.201 -	/// Assign the iterator to the next node.
   1.202 -	///
   1.203 -	NodeIt& operator++() { return *this; }
   1.204 +        /// Assign the iterator to the next node.
   1.205 +        ///
   1.206 +        NodeIt& operator++() { return *this; }
   1.207        };
   1.208      
   1.209      
   1.210 @@ -217,31 +217,31 @@
   1.211        ///
   1.212        class Edge {
   1.213        public:
   1.214 -	/// Default constructor
   1.215 +        /// Default constructor
   1.216  
   1.217 -	/// @warning The default constructor sets the iterator
   1.218 -	/// to an undefined value.
   1.219 -	Edge() { }
   1.220 -	/// Copy constructor.
   1.221 +        /// @warning The default constructor sets the iterator
   1.222 +        /// to an undefined value.
   1.223 +        Edge() { }
   1.224 +        /// Copy constructor.
   1.225  
   1.226 -	/// Copy constructor.
   1.227 -	///
   1.228 -	Edge(const Edge&) { }
   1.229 -	/// Initialize the iterator to be invalid.
   1.230 +        /// Copy constructor.
   1.231 +        ///
   1.232 +        Edge(const Edge&) { }
   1.233 +        /// Initialize the iterator to be invalid.
   1.234  
   1.235 -	/// Initialize the iterator to be invalid.
   1.236 -	///
   1.237 -	Edge(Invalid) { }
   1.238 -	/// Equality operator
   1.239 +        /// Initialize the iterator to be invalid.
   1.240 +        ///
   1.241 +        Edge(Invalid) { }
   1.242 +        /// Equality operator
   1.243  
   1.244 -	/// Two iterators are equal if and only if they point to the
   1.245 -	/// same object or both are invalid.
   1.246 -	bool operator==(Edge) const { return true; }
   1.247 -	/// Inequality operator
   1.248 +        /// Two iterators are equal if and only if they point to the
   1.249 +        /// same object or both are invalid.
   1.250 +        bool operator==(Edge) const { return true; }
   1.251 +        /// Inequality operator
   1.252  
   1.253 -	/// \sa operator==(Node n)
   1.254 -	///
   1.255 -	bool operator!=(Edge) const { return true; }
   1.256 +        /// \sa operator==(Node n)
   1.257 +        ///
   1.258 +        bool operator!=(Edge) const { return true; }
   1.259        };
   1.260      
   1.261        /// This iterator goes trough the outgoing edges of a node.
   1.262 @@ -258,39 +258,39 @@
   1.263      
   1.264        class OutEdgeIt : public Edge {
   1.265        public:
   1.266 -	/// Default constructor
   1.267 +        /// Default constructor
   1.268  
   1.269 -	/// @warning The default constructor sets the iterator
   1.270 -	/// to an undefined value.
   1.271 -	OutEdgeIt() { }
   1.272 -	/// Copy constructor.
   1.273 +        /// @warning The default constructor sets the iterator
   1.274 +        /// to an undefined value.
   1.275 +        OutEdgeIt() { }
   1.276 +        /// Copy constructor.
   1.277  
   1.278 -	/// Copy constructor.
   1.279 -	///
   1.280 -	OutEdgeIt(const OutEdgeIt& e) : Edge(e) { }
   1.281 -	/// Initialize the iterator to be invalid.
   1.282 +        /// Copy constructor.
   1.283 +        ///
   1.284 +        OutEdgeIt(const OutEdgeIt& e) : Edge(e) { }
   1.285 +        /// Initialize the iterator to be invalid.
   1.286  
   1.287 -	/// Initialize the iterator to be invalid.
   1.288 -	///
   1.289 -	OutEdgeIt(Invalid) { }
   1.290 -	/// This constructor sets the iterator to first outgoing edge.
   1.291 +        /// Initialize the iterator to be invalid.
   1.292 +        ///
   1.293 +        OutEdgeIt(Invalid) { }
   1.294 +        /// This constructor sets the iterator to the first outgoing edge.
   1.295      
   1.296 -	/// This constructor set the iterator to the first outgoing edge of
   1.297 -	/// node
   1.298 -	///@param n the node
   1.299 -	///@param g the graph
   1.300 -	OutEdgeIt(const StaticGraph&, const Node&) { }
   1.301 -	/// Edge -> OutEdgeIt conversion
   1.302 +        /// This constructor sets the iterator to the first outgoing edge of
   1.303 +        /// the node.
   1.304 +        ///@param n the node
   1.305 +        ///@param g the graph
   1.306 +        OutEdgeIt(const StaticGraph&, const Node&) { }
   1.307 +        /// Edge -> OutEdgeIt conversion
   1.308  
   1.309 -	/// Sets the iterator to the value of the trivial iterator \c e.
   1.310 -	/// This feature necessitates that each time we 
   1.311 -	/// iterate the edge-set, the iteration order is the same.
   1.312 -	OutEdgeIt(const StaticGraph& g, const Edge& e) { }
   1.313 -	///Next outgoing edge
   1.314 -	
   1.315 -	/// Assign the iterator to the next 
   1.316 -	/// outgoing edge of the corresponding node.
   1.317 -	OutEdgeIt& operator++() { return *this; }
   1.318 +        /// Sets the iterator to the value of the trivial iterator \c e.
   1.319 +        /// This feature necessitates that each time we 
   1.320 +        /// iterate the edge-set, the iteration order is the same.
   1.321 +        OutEdgeIt(const StaticGraph& g, const Edge& e) { }
   1.322 +        ///Next outgoing edge
   1.323 +        
   1.324 +        /// Assign the iterator to the next 
   1.325 +        /// outgoing edge of the corresponding node.
   1.326 +        OutEdgeIt& operator++() { return *this; }
   1.327        };
   1.328  
   1.329        /// This iterator goes trough the incoming edges of a node.
   1.330 @@ -307,39 +307,39 @@
   1.331  
   1.332        class InEdgeIt : public Edge {
   1.333        public:
   1.334 -	/// Default constructor
   1.335 +        /// Default constructor
   1.336  
   1.337 -	/// @warning The default constructor sets the iterator
   1.338 -	/// to an undefined value.
   1.339 -	InEdgeIt() { }
   1.340 -	/// Copy constructor.
   1.341 +        /// @warning The default constructor sets the iterator
   1.342 +        /// to an undefined value.
   1.343 +        InEdgeIt() { }
   1.344 +        /// Copy constructor.
   1.345  
   1.346 -	/// Copy constructor.
   1.347 -	///
   1.348 -	InEdgeIt(const InEdgeIt& e) : Edge(e) { }
   1.349 -	/// Initialize the iterator to be invalid.
   1.350 +        /// Copy constructor.
   1.351 +        ///
   1.352 +        InEdgeIt(const InEdgeIt& e) : Edge(e) { }
   1.353 +        /// Initialize the iterator to be invalid.
   1.354  
   1.355 -	/// Initialize the iterator to be invalid.
   1.356 -	///
   1.357 -	InEdgeIt(Invalid) { }
   1.358 -	/// This constructor sets the iterator to first incoming edge.
   1.359 +        /// Initialize the iterator to be invalid.
   1.360 +        ///
   1.361 +        InEdgeIt(Invalid) { }
   1.362 +        /// This constructor sets the iterator to first incoming edge.
   1.363      
   1.364 -	/// This constructor set the iterator to the first incoming edge of
   1.365 -	/// node
   1.366 -	///@param n the node
   1.367 -	///@param g the graph
   1.368 -	InEdgeIt(const StaticGraph&, const Node&) { }
   1.369 -	/// Edge -> InEdgeIt conversion
   1.370 +        /// This constructor set the iterator to the first incoming edge of
   1.371 +        /// the node.
   1.372 +        ///@param n the node
   1.373 +        ///@param g the graph
   1.374 +        InEdgeIt(const StaticGraph&, const Node&) { }
   1.375 +        /// Edge -> InEdgeIt conversion
   1.376  
   1.377 -	/// Sets the iterator to the value of the trivial iterator \c e.
   1.378 -	/// This feature necessitates that each time we 
   1.379 -	/// iterate the edge-set, the iteration order is the same.
   1.380 -	InEdgeIt(const StaticGraph&, const Edge&) { }
   1.381 -	/// Next incoming edge
   1.382 +        /// Sets the iterator to the value of the trivial iterator \c e.
   1.383 +        /// This feature necessitates that each time we 
   1.384 +        /// iterate the edge-set, the iteration order is the same.
   1.385 +        InEdgeIt(const StaticGraph&, const Edge&) { }
   1.386 +        /// Next incoming edge
   1.387  
   1.388 -	/// Assign the iterator to the next inedge of the corresponding node.
   1.389 -	///
   1.390 -	InEdgeIt& operator++() { return *this; }
   1.391 +        /// Assign the iterator to the next inedge of the corresponding node.
   1.392 +        ///
   1.393 +        InEdgeIt& operator++() { return *this; }
   1.394        };
   1.395        /// This iterator goes through each edge.
   1.396  
   1.397 @@ -352,38 +352,36 @@
   1.398        /// \endcode
   1.399        class EdgeIt : public Edge {
   1.400        public:
   1.401 -	/// Default constructor
   1.402 +        /// Default constructor
   1.403  
   1.404 -	/// @warning The default constructor sets the iterator
   1.405 -	/// to an undefined value.
   1.406 -	EdgeIt() { }
   1.407 -	/// Copy constructor.
   1.408 +        /// @warning The default constructor sets the iterator
   1.409 +        /// to an undefined value.
   1.410 +        EdgeIt() { }
   1.411 +        /// Copy constructor.
   1.412  
   1.413 -	/// Copy constructor.
   1.414 -	///
   1.415 -	EdgeIt(const EdgeIt& e) : Edge(e) { }
   1.416 -	/// Initialize the iterator to be invalid.
   1.417 +        /// Copy constructor.
   1.418 +        ///
   1.419 +        EdgeIt(const EdgeIt& e) : Edge(e) { }
   1.420 +        /// Initialize the iterator to be invalid.
   1.421  
   1.422 -	/// Initialize the iterator to be invalid.
   1.423 -	///
   1.424 -	EdgeIt(Invalid) { }
   1.425 -	/// This constructor sets the iterator to first edge.
   1.426 +        /// Initialize the iterator to be invalid.
   1.427 +        ///
   1.428 +        EdgeIt(Invalid) { }
   1.429 +        /// This constructor sets the iterator to the first edge.
   1.430      
   1.431 -	/// This constructor set the iterator to the first edge of
   1.432 -	/// node
   1.433 -	///@param g the graph
   1.434 -	EdgeIt(const StaticGraph&) { }
   1.435 -	/// Edge -> EdgeIt conversion
   1.436 +        /// This constructor sets the iterator to the first edge of \c g.
   1.437 +        ///@param g the graph
   1.438 +        EdgeIt(const StaticGraph&) { }
   1.439 +        /// Edge -> EdgeIt conversion
   1.440  
   1.441 -	/// Sets the iterator to the value of the trivial iterator \c e.
   1.442 -	/// This feature necessitates that each time we 
   1.443 -	/// iterate the edge-set, the iteration order is the same.
   1.444 -	EdgeIt(const StaticGraph&, const Edge&) { } 
   1.445 -    	///Next edge
   1.446 -	
   1.447 -	/// Assign the iterator to the next 
   1.448 -	/// edge of the corresponding node.
   1.449 -	EdgeIt& operator++() { return *this; }
   1.450 +        /// Sets the iterator to the value of the trivial iterator \c e.
   1.451 +        /// This feature necessitates that each time we 
   1.452 +        /// iterate the edge-set, the iteration order is the same.
   1.453 +        EdgeIt(const StaticGraph&, const Edge&) { } 
   1.454 +        ///Next edge
   1.455 +        
   1.456 +        /// Assign the iterator to the next edge.
   1.457 +        EdgeIt& operator++() { return *this; }
   1.458        };
   1.459        ///Gives back the target node of an edge.
   1.460  
   1.461 @@ -407,16 +405,16 @@
   1.462        {
   1.463        public:
   1.464  
   1.465 -	///\e
   1.466 -	NodeMap(const StaticGraph&) { }
   1.467 -	///\e
   1.468 -	NodeMap(const StaticGraph&, T) { }
   1.469 +        ///\e
   1.470 +        NodeMap(const StaticGraph&) { }
   1.471 +        ///\e
   1.472 +        NodeMap(const StaticGraph&, T) { }
   1.473  
   1.474 -	///Copy constructor
   1.475 -	NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
   1.476 -	///Assignment operator
   1.477 -	NodeMap& operator=(const NodeMap&) { return *this; }
   1.478 -	// \todo fix this concept
   1.479 +        ///Copy constructor
   1.480 +        NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
   1.481 +        ///Assignment operator
   1.482 +        NodeMap& operator=(const NodeMap&) { return *this; }
   1.483 +        // \todo fix this concept
   1.484        };
   1.485  
   1.486        /// Read write map of the edges to type \c T.
   1.487 @@ -431,15 +429,15 @@
   1.488        {
   1.489        public:
   1.490  
   1.491 -	///\e
   1.492 -	EdgeMap(const StaticGraph&) { }
   1.493 -	///\e
   1.494 -	EdgeMap(const StaticGraph&, T) { }
   1.495 -	///Copy constructor
   1.496 -	EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) { }
   1.497 -	///Assignment operator
   1.498 -	EdgeMap& operator=(const EdgeMap&) { return *this; }
   1.499 -	// \todo fix this concept    
   1.500 +        ///\e
   1.501 +        EdgeMap(const StaticGraph&) { }
   1.502 +        ///\e
   1.503 +        EdgeMap(const StaticGraph&, T) { }
   1.504 +        ///Copy constructor
   1.505 +        EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) { }
   1.506 +        ///Assignment operator
   1.507 +        EdgeMap& operator=(const EdgeMap&) { return *this; }
   1.508 +        // \todo fix this concept    
   1.509        };
   1.510  
   1.511        template <typename _Graph>
   1.512 @@ -449,9 +447,8 @@
   1.513  
   1.514      /// An empty non-static graph class.
   1.515      
   1.516 -    /// This class provides everything that \ref StaticGraph
   1.517 -    /// with additional functionality which enables to build a
   1.518 -    /// graph from scratch.
   1.519 +    /// This class provides everything that \ref StaticGraph does.
   1.520 +    /// Additionally it enables building graphs from scratch.
   1.521      class ExtendableGraph : public StaticGraph
   1.522      {
   1.523      public:
   1.524 @@ -486,7 +483,7 @@
   1.525  
   1.526      /// An empty erasable graph class.
   1.527    
   1.528 -    /// This class is an extension of \ref ExtendableGraph. It also makes it
   1.529 +    /// This class is an extension of \ref ExtendableGraph. It makes it
   1.530      /// possible to erase edges or nodes.
   1.531      class ErasableGraph : public ExtendableGraph
   1.532      {