klao@959: /* -*- C++ -*-
klao@959:  *
alpar@1956:  * This file is a part of LEMON, a generic C++ optimization library
alpar@1956:  *
alpar@1956:  * Copyright (C) 2003-2006
alpar@1956:  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
alpar@1359:  * (Egervary Research Group on Combinatorial Optimization, EGRES).
klao@959:  *
klao@959:  * Permission to use, modify and distribute this software is granted
klao@959:  * provided that this copyright notice appears in all copies. For
klao@959:  * precise terms see the accompanying LICENSE file.
klao@959:  *
klao@959:  * This software is provided "AS IS" with no warranty of any kind,
klao@959:  * express or implied, and with no claim as to its suitability for any
klao@959:  * purpose.
klao@959:  *
klao@959:  */
klao@959: 
klao@959: #ifndef LEMON_CONCEPT_GRAPH_H
klao@959: #define LEMON_CONCEPT_GRAPH_H
klao@959: 
klao@1030: ///\ingroup graph_concepts
klao@959: ///\file
klao@959: ///\brief Declaration of Graph.
klao@959: 
deba@1993: #include <lemon/bits/invalid.h>
deba@1993: #include <lemon/bits/utility.h>
klao@959: #include <lemon/concept/maps.h>
klao@959: #include <lemon/concept_check.h>
klao@959: #include <lemon/concept/graph_component.h>
klao@959: 
klao@959: namespace lemon {
klao@959:   namespace concept {
deba@1136: 
klao@959:     
klao@961:     /**************** The full-featured graph concepts ****************/
klao@959: 
deba@1136: 
klao@1760:     // \brief Modular static graph class.
klao@1760:     //     
klao@1760:     // It should be the same as the \c StaticGraph class.
deba@1136:     class _StaticGraph 
klao@961:       :  virtual public BaseGraphComponent,
ladanyi@1426:          public IterableGraphComponent, public MappableGraphComponent {
klao@959:     public:
alpar@1448: 
klao@959:       typedef BaseGraphComponent::Node Node;
klao@959:       typedef BaseGraphComponent::Edge Edge;
klao@959: 
deba@989:       template <typename _Graph>
deba@989:       struct Constraints {
ladanyi@1426:         void constraints() {
ladanyi@1426:           checkConcept<IterableGraphComponent, _Graph>();
ladanyi@1426:           checkConcept<MappableGraphComponent, _Graph>();
ladanyi@1426:         }
deba@989:       };
klao@959:     };
klao@959: 
klao@1760:     // \brief Modular extendable graph class.
klao@1760:     //     
klao@1760:     // It should be the same as the \c ExtendableGraph class.
deba@1136:     class _ExtendableGraph 
deba@1136:       :  virtual public BaseGraphComponent, public _StaticGraph,
ladanyi@1426:          public ExtendableGraphComponent, public ClearableGraphComponent {
klao@959:     public:
klao@959:       typedef BaseGraphComponent::Node Node;
klao@959:       typedef BaseGraphComponent::Edge Edge;
klao@959: 
deba@989:       template <typename _Graph>
deba@989:       struct Constraints {
ladanyi@1426:         void constraints() {
ladanyi@1426:           checkConcept<_StaticGraph, _Graph >();
ladanyi@1426:           checkConcept<ExtendableGraphComponent, _Graph >();
ladanyi@1426:           checkConcept<ClearableGraphComponent, _Graph >();
ladanyi@1426:         }
deba@989:       };
klao@959:     };
klao@959: 
klao@1760:     // \brief Modular erasable graph class.
klao@1760:     //     
klao@1760:     // It should be the same as the \c ErasableGraph class.
deba@1136:     class _ErasableGraph 
deba@1136:       :  virtual public BaseGraphComponent, public _ExtendableGraph,
ladanyi@1426:          public ErasableGraphComponent {
klao@959:     public:
klao@959:       typedef BaseGraphComponent::Node Node;
klao@959:       typedef BaseGraphComponent::Edge Edge;
klao@959: 
deba@989:       template <typename _Graph>
deba@989:       struct Constraints {
ladanyi@1426:         void constraints() {
ladanyi@1426:           checkConcept<_ExtendableGraph, _Graph >();
ladanyi@1426:           checkConcept<ErasableGraphComponent, _Graph >();
ladanyi@1426:         }
deba@989:       };
klao@959:     };
klao@959: 
alpar@1620:     /// \addtogroup graph_concepts
alpar@1620:     /// @{
alpar@1620: 
deba@1136:     /// An empty static graph class.
deba@1136:   
deba@1136:     /// This class provides all the common features of a graph structure,
deba@1136:     /// however completely without implementations and real data structures
deba@1136:     /// behind the interface.
deba@1136:     /// All graph algorithms should compile with this class, but it will not
deba@1136:     /// run properly, of course.
deba@1136:     ///
deba@1136:     /// It can be used for checking the interface compatibility,
deba@1136:     /// or it can serve as a skeleton of a new graph structure.
deba@1136:     /// 
deba@1136:     /// Also, you will find here the full documentation of a certain graph
deba@1136:     /// feature, the documentation of a real graph imlementation
deba@1136:     /// like @ref ListGraph or
deba@1136:     /// @ref SmartGraph will just refer to this structure.
deba@1136:     ///
deba@1136:     /// \todo A pages describing the concept of concept description would
deba@1136:     /// be nice.
deba@1136:     class StaticGraph
deba@1136:     {
deba@1136:     public:
alpar@1448:       ///\e
alpar@1448: 
deba@1136:       /// Defalult constructor.
deba@1136: 
deba@1136:       /// Defalult constructor.
deba@1136:       ///
deba@1136:       StaticGraph() { }
deba@1136:       ///Copy consructor.
deba@1136: 
deba@1136: //       ///\todo It is not clear, what we expect from a copy constructor.
deba@1136: //       ///E.g. How to assign the nodes/edges to each other? What about maps?
deba@1136: //       StaticGraph(const StaticGraph& g) { }
deba@1136: 
deba@1136:       /// The base type of node iterators, 
deba@1136:       /// or in other words, the trivial node iterator.
deba@1136: 
deba@1136:       /// This is the base type of each node iterator,
deba@1136:       /// thus each kind of node iterator converts to this.
deba@1136:       /// More precisely each kind of node iterator should be inherited 
deba@1136:       /// from the trivial node iterator.
deba@1136:       class Node {
deba@1136:       public:
ladanyi@1426:         /// Default constructor
deba@1136: 
ladanyi@1426:         /// @warning The default constructor sets the iterator
ladanyi@1426:         /// to an undefined value.
ladanyi@1426:         Node() { }
ladanyi@1426:         /// Copy constructor.
deba@1136: 
ladanyi@1426:         /// Copy constructor.
ladanyi@1426:         ///
ladanyi@1426:         Node(const Node&) { }
deba@1136: 
ladanyi@1426:         /// Invalid constructor \& conversion.
deba@1136: 
ladanyi@1426:         /// This constructor initializes the iterator to be invalid.
ladanyi@1426:         /// \sa Invalid for more details.
ladanyi@1426:         Node(Invalid) { }
ladanyi@1426:         /// Equality operator
deba@1136: 
ladanyi@1426:         /// Two iterators are equal if and only if they point to the
ladanyi@1426:         /// same object or both are invalid.
ladanyi@1426:         bool operator==(Node) const { return true; }
deba@1136: 
ladanyi@1426:         /// Inequality operator
ladanyi@1426:         
ladanyi@1426:         /// \sa operator==(Node n)
ladanyi@1426:         ///
ladanyi@1426:         bool operator!=(Node) const { return true; }
deba@1136: 
deba@1622: 	/// Artificial ordering operator.
deba@1622: 	
deba@1622: 	/// To allow the use of graph descriptors as key type in std::map or
deba@1622: 	/// similar associative container we require this.
deba@1622: 	///
deba@1622: 	/// \note This operator only have to define some strict ordering of
deba@1622: 	/// the items; this order has nothing to do with the iteration
deba@1622: 	/// ordering of the items.
deba@1622: 	///
deba@1622: 	/// \bug This is a technical requirement. Do we really need this?
deba@1622: 	bool operator<(Node) const { return false; }
deba@1622: 
deba@1136:       };
deba@1136:     
deba@1136:       /// This iterator goes through each node.
deba@1136: 
deba@1136:       /// This iterator goes through each node.
deba@1136:       /// Its usage is quite simple, for example you can count the number
deba@1136:       /// of nodes in graph \c g of type \c Graph like this:
alpar@1946:       ///\code
deba@1136:       /// int count=0;
ladanyi@1426:       /// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count;
alpar@1946:       ///\endcode
deba@1136:       class NodeIt : public Node {
deba@1136:       public:
ladanyi@1426:         /// Default constructor
deba@1136: 
ladanyi@1426:         /// @warning The default constructor sets the iterator
ladanyi@1426:         /// to an undefined value.
ladanyi@1426:         NodeIt() { }
ladanyi@1426:         /// Copy constructor.
ladanyi@1426:         
ladanyi@1426:         /// Copy constructor.
ladanyi@1426:         ///
ladanyi@1426:         NodeIt(const NodeIt& n) : Node(n) { }
ladanyi@1426:         /// Invalid constructor \& conversion.
deba@1136: 
ladanyi@1426:         /// Initialize the iterator to be invalid.
ladanyi@1426:         /// \sa Invalid for more details.
ladanyi@1426:         NodeIt(Invalid) { }
ladanyi@1426:         /// Sets the iterator to the first node.
deba@1136: 
ladanyi@1426:         /// Sets the iterator to the first node of \c g.
ladanyi@1426:         ///
ladanyi@1426:         NodeIt(const StaticGraph&) { }
ladanyi@1426:         /// Node -> NodeIt conversion.
deba@1136: 
deba@1470:         /// Sets the iterator to the node of \c the graph pointed by 
deba@1470: 	/// the trivial iterator.
ladanyi@1426:         /// This feature necessitates that each time we 
ladanyi@1426:         /// iterate the edge-set, the iteration order is the same.
deba@1470:         NodeIt(const StaticGraph&, const Node&) { }
ladanyi@1426:         /// Next node.
deba@1136: 
ladanyi@1426:         /// Assign the iterator to the next node.
ladanyi@1426:         ///
ladanyi@1426:         NodeIt& operator++() { return *this; }
deba@1136:       };
deba@1136:     
deba@1136:     
deba@1136:       /// The base type of the edge iterators.
deba@1136: 
deba@1136:       /// The base type of the edge iterators.
deba@1136:       ///
deba@1136:       class Edge {
deba@1136:       public:
ladanyi@1426:         /// Default constructor
deba@1136: 
ladanyi@1426:         /// @warning The default constructor sets the iterator
ladanyi@1426:         /// to an undefined value.
ladanyi@1426:         Edge() { }
ladanyi@1426:         /// Copy constructor.
deba@1136: 
ladanyi@1426:         /// Copy constructor.
ladanyi@1426:         ///
ladanyi@1426:         Edge(const Edge&) { }
ladanyi@1426:         /// Initialize the iterator to be invalid.
deba@1136: 
ladanyi@1426:         /// Initialize the iterator to be invalid.
ladanyi@1426:         ///
ladanyi@1426:         Edge(Invalid) { }
ladanyi@1426:         /// Equality operator
deba@1136: 
ladanyi@1426:         /// Two iterators are equal if and only if they point to the
ladanyi@1426:         /// same object or both are invalid.
ladanyi@1426:         bool operator==(Edge) const { return true; }
ladanyi@1426:         /// Inequality operator
deba@1136: 
alpar@1620:         /// \sa operator==(Edge n)
ladanyi@1426:         ///
ladanyi@1426:         bool operator!=(Edge) const { return true; }
deba@1622: 
deba@1622: 	/// Artificial ordering operator.
deba@1622: 	
deba@1622: 	/// To allow the use of graph descriptors as key type in std::map or
deba@1622: 	/// similar associative container we require this.
deba@1622: 	///
deba@1622: 	/// \note This operator only have to define some strict ordering of
deba@1622: 	/// the items; this order has nothing to do with the iteration
deba@1622: 	/// ordering of the items.
deba@1622: 	///
deba@1622: 	/// \bug This is a technical requirement. Do we really need this?
deba@1622: 	bool operator<(Edge) const { return false; }
deba@1136:       };
deba@1136:     
deba@1136:       /// This iterator goes trough the outgoing edges of a node.
deba@1136: 
deba@1136:       /// This iterator goes trough the \e outgoing edges of a certain node
deba@1136:       /// of a graph.
deba@1136:       /// Its usage is quite simple, for example you can count the number
deba@1136:       /// of outgoing edges of a node \c n
deba@1136:       /// in graph \c g of type \c Graph as follows.
alpar@1946:       ///\code
deba@1136:       /// int count=0;
deba@1136:       /// for (Graph::OutEdgeIt e(g, n); e!=INVALID; ++e) ++count;
alpar@1946:       ///\endcode
deba@1136:     
deba@1136:       class OutEdgeIt : public Edge {
deba@1136:       public:
ladanyi@1426:         /// Default constructor
deba@1136: 
ladanyi@1426:         /// @warning The default constructor sets the iterator
ladanyi@1426:         /// to an undefined value.
ladanyi@1426:         OutEdgeIt() { }
ladanyi@1426:         /// Copy constructor.
deba@1136: 
ladanyi@1426:         /// Copy constructor.
ladanyi@1426:         ///
ladanyi@1426:         OutEdgeIt(const OutEdgeIt& e) : Edge(e) { }
ladanyi@1426:         /// Initialize the iterator to be invalid.
deba@1136: 
ladanyi@1426:         /// Initialize the iterator to be invalid.
ladanyi@1426:         ///
ladanyi@1426:         OutEdgeIt(Invalid) { }
ladanyi@1426:         /// This constructor sets the iterator to the first outgoing edge.
deba@1136:     
ladanyi@1426:         /// This constructor sets the iterator to the first outgoing edge of
ladanyi@1426:         /// the node.
ladanyi@1426:         OutEdgeIt(const StaticGraph&, const Node&) { }
ladanyi@1426:         /// Edge -> OutEdgeIt conversion
deba@1136: 
deba@1470:         /// Sets the iterator to the value of the trivial iterator.
deba@1470: 	/// This feature necessitates that each time we 
ladanyi@1426:         /// iterate the edge-set, the iteration order is the same.
deba@1470:         OutEdgeIt(const StaticGraph&, const Edge&) { }
ladanyi@1426:         ///Next outgoing edge
ladanyi@1426:         
ladanyi@1426:         /// Assign the iterator to the next 
ladanyi@1426:         /// outgoing edge of the corresponding node.
ladanyi@1426:         OutEdgeIt& operator++() { return *this; }
deba@1136:       };
deba@1136: 
deba@1136:       /// This iterator goes trough the incoming edges of a node.
deba@1136: 
deba@1136:       /// This iterator goes trough the \e incoming edges of a certain node
deba@1136:       /// of a graph.
deba@1136:       /// Its usage is quite simple, for example you can count the number
deba@1136:       /// of outgoing edges of a node \c n
deba@1136:       /// in graph \c g of type \c Graph as follows.
alpar@1946:       ///\code
deba@1136:       /// int count=0;
deba@1136:       /// for(Graph::InEdgeIt e(g, n); e!=INVALID; ++e) ++count;
alpar@1946:       ///\endcode
deba@1136: 
deba@1136:       class InEdgeIt : public Edge {
deba@1136:       public:
ladanyi@1426:         /// Default constructor
deba@1136: 
ladanyi@1426:         /// @warning The default constructor sets the iterator
ladanyi@1426:         /// to an undefined value.
ladanyi@1426:         InEdgeIt() { }
ladanyi@1426:         /// Copy constructor.
deba@1136: 
ladanyi@1426:         /// Copy constructor.
ladanyi@1426:         ///
ladanyi@1426:         InEdgeIt(const InEdgeIt& e) : Edge(e) { }
ladanyi@1426:         /// Initialize the iterator to be invalid.
deba@1136: 
ladanyi@1426:         /// Initialize the iterator to be invalid.
ladanyi@1426:         ///
ladanyi@1426:         InEdgeIt(Invalid) { }
ladanyi@1426:         /// This constructor sets the iterator to first incoming edge.
deba@1136:     
ladanyi@1426:         /// This constructor set the iterator to the first incoming edge of
ladanyi@1426:         /// the node.
ladanyi@1426:         InEdgeIt(const StaticGraph&, const Node&) { }
ladanyi@1426:         /// Edge -> InEdgeIt conversion
deba@1136: 
ladanyi@1426:         /// Sets the iterator to the value of the trivial iterator \c e.
ladanyi@1426:         /// This feature necessitates that each time we 
ladanyi@1426:         /// iterate the edge-set, the iteration order is the same.
ladanyi@1426:         InEdgeIt(const StaticGraph&, const Edge&) { }
ladanyi@1426:         /// Next incoming edge
deba@1136: 
ladanyi@1426:         /// Assign the iterator to the next inedge of the corresponding node.
ladanyi@1426:         ///
ladanyi@1426:         InEdgeIt& operator++() { return *this; }
deba@1136:       };
deba@1136:       /// This iterator goes through each edge.
deba@1136: 
deba@1136:       /// This iterator goes through each edge of a graph.
deba@1136:       /// Its usage is quite simple, for example you can count the number
deba@1136:       /// of edges in a graph \c g of type \c Graph as follows:
alpar@1946:       ///\code
deba@1136:       /// int count=0;
deba@1136:       /// for(Graph::EdgeIt e(g); e!=INVALID; ++e) ++count;
alpar@1946:       ///\endcode
deba@1136:       class EdgeIt : public Edge {
deba@1136:       public:
ladanyi@1426:         /// Default constructor
deba@1136: 
ladanyi@1426:         /// @warning The default constructor sets the iterator
ladanyi@1426:         /// to an undefined value.
ladanyi@1426:         EdgeIt() { }
ladanyi@1426:         /// Copy constructor.
deba@1136: 
ladanyi@1426:         /// Copy constructor.
ladanyi@1426:         ///
ladanyi@1426:         EdgeIt(const EdgeIt& e) : Edge(e) { }
ladanyi@1426:         /// Initialize the iterator to be invalid.
deba@1136: 
ladanyi@1426:         /// Initialize the iterator to be invalid.
ladanyi@1426:         ///
ladanyi@1426:         EdgeIt(Invalid) { }
ladanyi@1426:         /// This constructor sets the iterator to the first edge.
deba@1136:     
ladanyi@1426:         /// This constructor sets the iterator to the first edge of \c g.
ladanyi@1426:         ///@param g the graph
alpar@1643:         EdgeIt(const StaticGraph& g) { ignore_unused_variable_warning(g); }
ladanyi@1426:         /// Edge -> EdgeIt conversion
deba@1136: 
ladanyi@1426:         /// Sets the iterator to the value of the trivial iterator \c e.
ladanyi@1426:         /// This feature necessitates that each time we 
ladanyi@1426:         /// iterate the edge-set, the iteration order is the same.
ladanyi@1426:         EdgeIt(const StaticGraph&, const Edge&) { } 
ladanyi@1426:         ///Next edge
ladanyi@1426:         
ladanyi@1426:         /// Assign the iterator to the next edge.
ladanyi@1426:         EdgeIt& operator++() { return *this; }
deba@1136:       };
deba@1136:       ///Gives back the target node of an edge.
deba@1136: 
deba@1136:       ///Gives back the target node of an edge.
deba@1136:       ///
deba@1136:       Node target(Edge) const { return INVALID; }
deba@1136:       ///Gives back the source node of an edge.
deba@1136: 
deba@1136:       ///Gives back the source node of an edge.
deba@1136:       ///
deba@1136:       Node source(Edge) const { return INVALID; }
deba@1563: 
alpar@1630: //       /// Gives back the first Node in the iterating order.
deba@1563:       
alpar@1630: //       /// Gives back the first Node in the iterating order.
alpar@1630: //       ///     
deba@1563:       void first(Node&) const {}
deba@1563: 
alpar@1630: //       /// Gives back the next Node in the iterating order.
deba@1563:       
alpar@1630: //       /// Gives back the next Node in the iterating order.
alpar@1630: //       ///     
deba@1563:       void next(Node&) const {}
deba@1563: 
alpar@1630: //       /// Gives back the first Edge in the iterating order.
deba@1563:       
alpar@1630: //       /// Gives back the first Edge in the iterating order.
alpar@1630: //       ///     
deba@1563:       void first(Edge&) const {}
alpar@1630: //       /// Gives back the next Edge in the iterating order.
deba@1563:       
alpar@1630: //       /// Gives back the next Edge in the iterating order.
alpar@1630: //       ///     
deba@1563:       void next(Edge&) const {}
deba@1563: 
deba@1563: 
alpar@1630: //       /// Gives back the first of the Edges point to the given Node.
deba@1563:       
alpar@1630: //       /// Gives back the first of the Edges point to the given Node.
alpar@1630: //       ///     
deba@1563:       void firstIn(Edge&, const Node&) const {}
deba@1563: 
alpar@1630: //       /// Gives back the next of the Edges points to the given Node.
deba@1563: 
deba@1563: 
alpar@1630: //       /// Gives back the next of the Edges points to the given Node.
alpar@1630: //       ///
deba@1563:       void nextIn(Edge&) const {}
deba@1563: 
alpar@1630: //       /// Gives back the first of the Edges start from the given Node.
deba@1563:       
alpar@1630: //       /// Gives back the first of the Edges start from the given Node.
alpar@1630: //       ///     
deba@1563:       void firstOut(Edge&, const Node&) const {}
deba@1563: 
alpar@1630: //       /// Gives back the next of the Edges start from the given Node.
deba@1563:       
alpar@1630: //       /// Gives back the next of the Edges start from the given Node.
alpar@1630: //       ///     
deba@1563:       void nextOut(Edge&) const {}
deba@1563: 
deba@1563:       /// \brief The base node of the iterator.
deba@1563:       ///
deba@1563:       /// Gives back the base node of the iterator.
deba@1627:       /// It is always the target of the pointed edge.
deba@1563:       Node baseNode(const InEdgeIt&) const { return INVALID; }
deba@1563: 
deba@1563:       /// \brief The running node of the iterator.
deba@1563:       ///
deba@1563:       /// Gives back the running node of the iterator.
deba@1627:       /// It is always the source of the pointed edge.
deba@1563:       Node runningNode(const InEdgeIt&) const { return INVALID; }
deba@1563: 
deba@1563:       /// \brief The base node of the iterator.
deba@1563:       ///
deba@1563:       /// Gives back the base node of the iterator.
deba@1627:       /// It is always the source of the pointed edge.
deba@1563:       Node baseNode(const OutEdgeIt&) const { return INVALID; }
deba@1563: 
deba@1563:       /// \brief The running node of the iterator.
deba@1563:       ///
deba@1563:       /// Gives back the running node of the iterator.
deba@1627:       /// It is always the target of the pointed edge.
deba@1563:       Node runningNode(const OutEdgeIt&) const { return INVALID; }
deba@1136: 
deba@1627:       /// \brief The opposite node on the given edge.
deba@1627:       ///
deba@1627:       /// Gives back the opposite node on the given edge.
deba@1627:       Node oppositeNode(const Node&, const Edge&) const { return INVALID; }
deba@1627: 
deba@1627:       /// \brief Read write map of the nodes to type \c T.
deba@1627:       /// 
deba@1136:       /// ReadWrite map of the nodes to type \c T.
deba@1136:       /// \sa Reference
deba@1136:       /// \warning Making maps that can handle bool type (NodeMap<bool>)
deba@1136:       /// needs some extra attention!
alpar@1630:       /// \todo Wrong documentation
deba@1136:       template<class T> 
deba@1136:       class NodeMap : public ReadWriteMap< Node, T >
deba@1136:       {
deba@1136:       public:
deba@1136: 
ladanyi@1426:         ///\e
ladanyi@1426:         NodeMap(const StaticGraph&) { }
ladanyi@1426:         ///\e
ladanyi@1426:         NodeMap(const StaticGraph&, T) { }
deba@1136: 
ladanyi@1426:         ///Copy constructor
ladanyi@1426:         NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
ladanyi@1426:         ///Assignment operator
ladanyi@1426:         NodeMap& operator=(const NodeMap&) { return *this; }
ladanyi@1426:         // \todo fix this concept
deba@1136:       };
deba@1136: 
deba@1627:       /// \brief Read write map of the edges to type \c T.
deba@1627:       ///
deba@1627:       /// Reference map of the edges to type \c T.
deba@1136:       /// \sa Reference
deba@1136:       /// \warning Making maps that can handle bool type (EdgeMap<bool>)
deba@1136:       /// needs some extra attention!
alpar@1630:       /// \todo Wrong documentation
deba@1136:       template<class T> 
deba@1136:       class EdgeMap : public ReadWriteMap<Edge,T>
deba@1136:       {
deba@1136:       public:
deba@1136: 
ladanyi@1426:         ///\e
ladanyi@1426:         EdgeMap(const StaticGraph&) { }
ladanyi@1426:         ///\e
ladanyi@1426:         EdgeMap(const StaticGraph&, T) { }
ladanyi@1426:         ///Copy constructor
ladanyi@1426:         EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) { }
ladanyi@1426:         ///Assignment operator
ladanyi@1426:         EdgeMap& operator=(const EdgeMap&) { return *this; }
ladanyi@1426:         // \todo fix this concept    
deba@1136:       };
deba@1136: 
deba@1136:       template <typename _Graph>
deba@1136:       struct Constraints : public _StaticGraph::Constraints<_Graph> {};
deba@1136: 
deba@1136:     };
deba@1136: 
deba@1136:     /// An empty non-static graph class.
deba@1136:     
ladanyi@1426:     /// This class provides everything that \ref StaticGraph does.
ladanyi@1426:     /// Additionally it enables building graphs from scratch.
deba@1136:     class ExtendableGraph : public StaticGraph
deba@1136:     {
deba@1136:     public:
deba@1136:       /// Defalult constructor.
deba@1136: 
deba@1136:       /// Defalult constructor.
deba@1136:       ///
deba@1136:       ExtendableGraph() { }
deba@1136:       ///Add a new node to the graph.
deba@1136: 
deba@1136:       /// \return the new node.
deba@1136:       ///
deba@1136:       Node addNode() { return INVALID; }
deba@1136:       ///Add a new edge to the graph.
deba@1136: 
deba@1136:       ///Add a new edge to the graph with source node \c s
deba@1136:       ///and target node \c t.
deba@1136:       ///\return the new edge.
alpar@1367:       Edge addEdge(Node, Node) { return INVALID; }
deba@1136:     
deba@1136:       /// Resets the graph.
deba@1136: 
deba@1136:       /// This function deletes all edges and nodes of the graph.
deba@1136:       /// It also frees the memory allocated to store them.
deba@1136:       /// \todo It might belong to \ref ErasableGraph.
deba@1136:       void clear() { }
deba@1136: 
deba@1136:       template <typename _Graph>
deba@1136:       struct Constraints : public _ExtendableGraph::Constraints<_Graph> {};
deba@1136: 
deba@1136:     };
deba@1136: 
deba@1136:     /// An empty erasable graph class.
deba@1136:   
ladanyi@1426:     /// This class is an extension of \ref ExtendableGraph. It makes it
deba@1136:     /// possible to erase edges or nodes.
deba@1136:     class ErasableGraph : public ExtendableGraph
deba@1136:     {
deba@1136:     public:
deba@1136:       /// Defalult constructor.
deba@1136: 
deba@1136:       /// Defalult constructor.
deba@1136:       ///
deba@1136:       ErasableGraph() { }
deba@1136:       /// Deletes a node.
deba@1136: 
deba@1136:       /// Deletes node \c n node.
deba@1136:       ///
alpar@1367:       void erase(Node) { }
deba@1136:       /// Deletes an edge.
deba@1136: 
deba@1136:       /// Deletes edge \c e edge.
deba@1136:       ///
alpar@1367:       void erase(Edge) { }
deba@1136: 
deba@1136:       template <typename _Graph>
deba@1136:       struct Constraints : public _ErasableGraph::Constraints<_Graph> {};
deba@1136: 
deba@1136:     };
deba@1136:     
klao@959:     // @}
klao@959:   } //namespace concept  
klao@959: } //namespace lemon
klao@959: 
klao@959: 
klao@959: 
klao@959: #endif // LEMON_CONCEPT_GRAPH_H