src/work/marci/graph_concept.h
changeset 651 a56e043aeab1
parent 334 63703ea7d02f
child 652 4dfa1f79bf3e
equal deleted inserted replaced
3:81bef1fc208e 4:f26bf4e38e3d
     1 // -*- c++ -*-
     1 // -*- c++ -*-
     2 #ifndef HUGO_GRAPH_H
     2 #ifndef HUGO_GRAPH_H
     3 #define HUGO_GRAPH_H
     3 #define HUGO_GRAPH_H
     4 
     4 
     5 ///\file
     5 ///\file
     6 ///\brief Declaration of GraphSkeleturo.
     6 ///\brief Declaration of GraphConcept.
     7 
     7 
     8 #include <invalid.h>
     8 #include <hugo/invalid.h>
     9 
     9 
    10 /// The namespace of HugoLib
       
    11 namespace hugo {
    10 namespace hugo {
    12 
    11 
    13   /// @defgroup empty_graph The GraphSkeleturo class
    12   /// @defgroup empty_graph The GraphConcept class
    14   /// @{
    13   /// @{
    15 
    14 
    16   /// An empty graph class.
    15   /// An empty graph class.
    17   
    16   
    18   /// This class provides all the common features of a graph structure,
    17   /// This class provides all the common features of a graph structure,
    26   /// 
    25   /// 
    27   /// Also, you will find here the full documentation of a certain graph
    26   /// Also, you will find here the full documentation of a certain graph
    28   /// feature, the documentation of a real graph imlementation
    27   /// feature, the documentation of a real graph imlementation
    29   /// like @ref ListGraph or
    28   /// like @ref ListGraph or
    30   /// @ref SmartGraph will just refer to this structure.
    29   /// @ref SmartGraph will just refer to this structure.
    31   class GraphSkeleturo
    30   class GraphConcept
    32   {
    31   {
    33   public:
    32   public:
    34     /// Defalult constructor.
    33     /// Defalult constructor.
    35     GraphSkeleturo() {}
    34     GraphConcept() { }
    36     ///Copy consructor.
    35 
    37 
    36     /// \brief Copy consructor.
    38     ///\todo It is not clear, what we expect from a copy constructor.
    37     /// 
    39     ///E.g. How to assign the nodes/edges to each other? What about maps?
    38     /// \todo It is not clear, what we expect from a copy constructor.
    40     GraphSkeleturo(const GraphSkeleturo &G) {}
    39     /// E.g. How to assign the nodes/edges to each other? What about maps?
    41 
    40     GraphConcept(const GraphConcept&) { }
    42     /// The base type of the node iterators.
    41 
    43 
    42     /// \brief The base type of the node iterators.
       
    43     ///
    44     /// This is the base type of each node iterators,
    44     /// This is the base type of each node iterators,
    45     /// thus each kind of node iterator will convert to this.
    45     /// thus each kind of node iterator will convert to this.
       
    46     /// Sometimes it is said to be a trivial iterator.
    46     class Node {
    47     class Node {
    47     public:
    48     public:
    48       /// @warning The default constructor sets the iterator
    49       /// @warning The default constructor sets the iterator
    49       /// to an undefined value.
    50       /// to an undefined value.
    50       Node() {}   //FIXME
    51       Node() { }   //FIXME
    51       /// Invalid constructor \& conversion.
    52 
    52 
    53       // /// Copy constructor.
       
    54       // Node(const Node&) { }
       
    55 
       
    56       /// \brief Invalid constructor \& conversion.
       
    57       /// 
    53       /// This constructor initializes the iterator to be invalid.
    58       /// This constructor initializes the iterator to be invalid.
    54       /// \sa Invalid for more details.
    59       /// \sa Invalid for more details.
    55 
    60       Node(const Invalid&) { }
    56       Node(Invalid) {}
    61       
    57       //Node(const Node &) {}
       
    58 
       
    59       /// Two iterators are equal if and only if they point to the
    62       /// Two iterators are equal if and only if they point to the
    60       /// same object or both are invalid.
    63       /// same object or both are invalid.
    61       bool operator==(Node n) const { return true; }
    64       bool operator==(Node n) const { return true; }
    62 
    65 
    63       /// \sa \ref operator==(Node n)
    66       /// \sa \ref operator==(Node n)
    65       bool operator!=(Node n) const { return true; }
    68       bool operator!=(Node n) const { return true; }
    66 
    69 
    67       bool operator<(Node n) const { return true; }
    70       bool operator<(Node n) const { return true; }
    68     };
    71     };
    69     
    72     
    70     /// This iterator goes through each node.
       
    71 
       
    72     /// This iterator goes through each node.
       
    73     /// Its usage is quite simple, for example you can count the number
       
    74     /// of nodes in graph \c G of type \c Graph like this:
       
    75     /// \code
       
    76     ///int count=0;
       
    77     ///for(Graph::NodeIt n(G);G.valid(n);G.next(n)) count++;
       
    78     /// \endcode
       
    79     class NodeIt : public Node {
       
    80     public:
       
    81       /// @warning The default constructor sets the iterator
       
    82       /// to an undefined value.
       
    83       NodeIt() {} //FIXME
       
    84       /// Invalid constructor \& conversion.
       
    85 
       
    86       /// Initialize the iterator to be invalid
       
    87       /// \sa Invalid for more details.
       
    88       NodeIt(Invalid) {}
       
    89       /// Sets the iterator to the first node of \c G.
       
    90       NodeIt(const GraphSkeleturo &G) {}
       
    91       /// @warning The default constructor sets the iterator
       
    92       /// to an undefined value.
       
    93       NodeIt(const NodeIt &) {}
       
    94     };
       
    95     
       
    96     
       
    97     /// The base type of the edge iterators.
    73     /// The base type of the edge iterators.
    98     class Edge {
    74     class Edge {
    99     public:
    75     public:
   100       /// @warning The default constructor sets the iterator
    76       /// @warning The default constructor sets the iterator
   101       /// to an undefined value.
    77       /// to an undefined value.
   102       Edge() {}   //FIXME
    78       Edge() { }   //FIXME
       
    79 
       
    80       // /// Copy constructor.
       
    81       // Edge(const Edge&) { }
       
    82 
   103       /// Initialize the iterator to be invalid
    83       /// Initialize the iterator to be invalid
   104       Edge(Invalid) {}
    84       Edge(const Invalid&) { }
   105       /// Two iterators are equal if and only if they point to the
    85       /// Two iterators are equal if and only if they point to the
   106       /// same object or both are invalid.
    86       /// same object or both are invalid.
   107       bool operator==(Edge n) const { return true; }
    87       bool operator==(Edge n) const { return true; }
   108       bool operator!=(Edge n) const { return true; }
    88       bool operator!=(Edge n) const { return true; }
   109       bool operator<(Edge n) const { return true; }
    89       bool operator<(Edge n) const { return true; }
   110     };
    90     };
   111     
    91     
   112     //  class SymEdgeIt : public Edge {};
    92     //  class SymEdgeIt : public Edge {};
   113 
    93 
   114     /// This iterator goes through each edge.
    94 
   115 
       
   116     /// This iterator goes through each edge of a graph.
       
   117     /// Its usage is quite simple, for example you can count the number
       
   118     /// of edges in a graph \c G of type \c Graph as follows:
       
   119     /// \code
       
   120     ///int count=0;
       
   121     ///for(Graph::EdgeIt e(G);G.valid(e);G.next(e)) count++;
       
   122     /// \endcode
       
   123     class EdgeIt : public Edge {
       
   124     public:
       
   125       /// @warning The default constructor sets the iterator
       
   126       /// to an undefined value.
       
   127       EdgeIt() {}
       
   128       /// Initialize the iterator to be invalid
       
   129       EdgeIt(Invalid) {}
       
   130       EdgeIt(const GraphSkeleturo &) {}
       
   131     };
       
   132 
       
   133     /// First node of the graph.
       
   134 
       
   135     /// \post \c i and the return value will be the first node.
       
   136     ///
       
   137     NodeIt &first(NodeIt &i) const { return i;}
       
   138 
       
   139     /// The first incoming edge.
       
   140     InEdgeIt &first(InEdgeIt &i, Node n) const { return i;}
       
   141     /// The first outgoing edge.
       
   142     OutEdgeIt &first(OutEdgeIt &i, Node n) const { return i;}
       
   143     //  SymEdgeIt &first(SymEdgeIt &, Node) const { return i;}
    95     //  SymEdgeIt &first(SymEdgeIt &, Node) const { return i;}
   144     /// The first edge of the Graph.
       
   145     EdgeIt &first(EdgeIt &i) const { return i;}
       
   146 
    96 
   147 //     Node getNext(Node) const {}
    97 //     Node getNext(Node) const {}
   148 //     InEdgeIt getNext(InEdgeIt) const {}
    98 //     InEdgeIt getNext(InEdgeIt) const {}
   149 //     OutEdgeIt getNext(OutEdgeIt) const {}
    99 //     OutEdgeIt getNext(OutEdgeIt) const {}
   150 //     //SymEdgeIt getNext(SymEdgeIt) const {}
   100 //     //SymEdgeIt getNext(SymEdgeIt) const {}
   151 //     EdgeIt getNext(EdgeIt) const {}
   101 //     EdgeIt getNext(EdgeIt) const {}
   152 
   102 
   153     /// Go to the next node.
       
   154     NodeIt &next(NodeIt &i) const { return i;}
       
   155     /// Go to the next incoming edge.
       
   156     InEdgeIt &next(InEdgeIt &i) const { return i;}
       
   157     /// Go to the next outgoing edge.
       
   158     OutEdgeIt &next(OutEdgeIt &i) const { return i;}
       
   159     //SymEdgeIt &next(SymEdgeIt &) const {}
   103     //SymEdgeIt &next(SymEdgeIt &) const {}
   160     /// Go to the next edge.
   104 
   161     EdgeIt &next(EdgeIt &i) const { return i;}
   105 
   162 
   106     /// Gives back the head node of an edge.
   163     ///Gives back the head node of an edge.
   107     Node head(const Edge&) const { return INVALID; }
   164     Node head(Edge) const { return INVALID; }
   108     /// Gives back the tail node of an edge.
   165     ///Gives back the tail node of an edge.
   109     Node tail(const Edge&) const { return INVALID; }
   166     Node tail(Edge) const { return INVALID; }
       
   167   
   110   
   168     //   Node aNode(InEdgeIt) const {}
       
   169     //   Node aNode(OutEdgeIt) const {}
       
   170     //   Node aNode(SymEdgeIt) const {}
   111     //   Node aNode(SymEdgeIt) const {}
   171 
       
   172     //   Node bNode(InEdgeIt) const {}
       
   173     //   Node bNode(OutEdgeIt) const {}
       
   174     //   Node bNode(SymEdgeIt) const {}
   112     //   Node bNode(SymEdgeIt) const {}
   175 
   113 
   176     /// Checks if a node iterator is valid
   114     /// \brief Checks if a node iterator is valid
   177 
   115     /// 
   178     ///\todo Maybe, it would be better if iterator converted to
   116     /// \todo Maybe, it would be better if iterator converted to
   179     ///bool directly, as Jacint prefers.
   117     /// bool directly, as Jacint prefers.
   180     bool valid(const Node&) const { return true;}
   118     bool valid(const Node&) const { return true; }
   181     /// Checks if an edge iterator is valid
   119     /// \brief Checks if an edge iterator is valid
   182 
   120     /// 
   183     ///\todo Maybe, it would be better if iterator converted to
   121     /// \todo Maybe, it would be better if iterator converted to
   184     ///bool directly, as Jacint prefers.
   122     /// bool directly, as Jacint prefers.
   185     bool valid(const Edge&) const { return true;}
   123     bool valid(const Edge&) const { return true; }
   186 
   124 
   187     ///Gives back the \e id of a node.
   125     /// \brief Gives back the \e id of a node.
   188 
   126     /// 
   189     ///\warning Not all graph structures provide this feature.
   127     /// \warning Not all graph structures provide this feature.
   190     ///
   128     ///
   191     int id(const Node&) const { return 0;}
   129     int id(const Node&) const { return 0; }
   192     ///Gives back the \e id of an edge.
   130     /// \brief Gives back the \e id of an edge.
   193 
   131     ///
   194     ///\warning Not all graph structures provide this feature.
   132     /// \warning Not all graph structures provide this feature.
   195     ///
   133     ///
   196     int id(const Edge&) const { return 0;}
   134     int id(const Edge&) const { return 0; }
   197 
   135 
   198     //void setInvalid(Node &) const {};
   136     //void setInvalid(Node &) const {};
   199     //void setInvalid(Edge &) const {};
   137     //void setInvalid(Edge &) const {};
   200   
   138   
   201     ///Add a new node to the graph.
   139     /// \brief Add a new node to the graph.
   202 
   140     ///
   203     /// \return the new node.
   141     /// \return the new node.
   204     ///
   142     Node addNode() { return INVALID; }
   205     Node addNode() { return INVALID;}
   143     /// \brief Add a new edge to the graph.
   206     ///Add a new edge to the graph.
   144     ///
   207 
   145     /// Add a new edge to the graph with tail node \c tail
   208     ///Add a new edge to the graph with tail node \c tail
   146     /// and head node \c head.
   209     ///and head node \c head.
   147     /// \return the new edge.
   210     ///\return the new edge.
   148     Edge addEdge(const Node& tail, const Node& head) { return INVALID; }
   211     Edge addEdge(Node tail, Node head) { return INVALID;}
       
   212     
   149     
   213     /// Resets the graph.
   150     /// \brief Resets the graph.
   214 
   151     /// 
   215     /// This function deletes all edges and nodes of the graph.
   152     /// This function deletes all edges and nodes of the graph.
   216     /// It also frees the memory allocated to store them.
   153     /// It also frees the memory allocated to store them.
   217     void clear() {}
   154     /// \todo What happens with the maps?
   218 
   155     void clear() { }
   219     ///Read/write/reference map of the nodes to type \c T.
   156 
   220 
   157     /// Read/write/reference map of the nodes to type \c T.
   221     ///Read/write/reference map of the nodes to type \c T.
   158 
   222     /// \sa MemoryMapSkeleturo
   159     /// Read/write/reference map of the nodes to type \c T.
       
   160     /// \sa MemoryMapConcept
   223     /// \todo We may need copy constructor
   161     /// \todo We may need copy constructor
   224     /// \todo We may need conversion from other nodetype
   162     /// \todo We may need conversion from other nodetype
   225     /// \todo We may need operator=
   163     /// \todo We may need operator=
   226     /// \warning Making maps that can handle bool type (NodeMap<bool>)
   164     /// \warning Making maps that can handle bool type (NodeMap<bool>)
   227     /// needs extra attention!
   165     /// needs extra attention!
   230     {
   168     {
   231     public:
   169     public:
   232       typedef T ValueType;
   170       typedef T ValueType;
   233       typedef Node KeyType;
   171       typedef Node KeyType;
   234 
   172 
   235       NodeMap(const GraphSkeleturo &G) {}
   173       NodeMap(const GraphConcept& g) { }
   236       NodeMap(const GraphSkeleturo &G, T t) {}
   174       NodeMap(const GraphConcept& g, T t) { }
   237 
   175 
   238       template<typename TT> NodeMap(const NodeMap<TT> &m) {}
   176       template<typename TT> NodeMap(const NodeMap<TT>& m) { }
   239 
   177 
   240       /// Sets the value of a node.
   178       /// Sets the value of a node.
   241 
   179 
   242       /// Sets the value associated with node \c i to the value \c t.
   180       /// Sets the value associated with node \c i to the value \c t.
   243       ///
   181       ///
   249 
   187 
   250       /// Updates the map if the graph has been changed
   188       /// Updates the map if the graph has been changed
   251 
   189 
   252       /// \todo Do we need this?
   190       /// \todo Do we need this?
   253       ///
   191       ///
   254       void update() {}
   192       void update() { }
   255       void update(T a) {}   //FIXME: Is it necessary
   193       //void update(T a) { }   //FIXME: Is it necessary
   256     };
   194     };
   257 
   195 
   258     ///Read/write/reference map of the edges to type \c T.
   196     ///Read/write/reference map of the edges to type \c T.
   259 
   197 
   260     ///Read/write/reference map of the edges to type \c T.
   198     /// Read/write/reference map of the edges to type \c T.
   261     ///It behaves exactly in the same way as \ref NodeMap.
   199     /// It behaves exactly in the same way as \ref NodeMap.
   262     /// \sa NodeMap
   200     /// \sa NodeMap
   263     /// \sa MemoryMapSkeleturo
   201     /// \sa MemoryMapConcept
   264     /// \todo We may need copy constructor
   202     /// \todo We may need copy constructor
   265     /// \todo We may need conversion from other edgetype
   203     /// \todo We may need conversion from other edgetype
   266     /// \todo We may need operator=
   204     /// \todo We may need operator=
   267     template<class T> class EdgeMap
   205     template<class T> class EdgeMap
   268     {
   206     {
   269     public:
   207     public:
   270       typedef T ValueType;
   208       typedef T ValueType;
   271       typedef Edge KeyType;
   209       typedef Edge KeyType;
   272 
   210 
   273       EdgeMap(const GraphSkeleturo &G) {}
   211       EdgeMap(const GraphConcept& g) {}
   274       EdgeMap(const GraphSkeleturo &G, T t) {}
   212       EdgeMap(const GraphConcept& g, T t) {}
   275     
   213     
   276       void set(Edge i, T t) {}
   214       void set(Edge i, T t) {}
   277       T get(Edge i) const {return *(T*)0;}
   215       T get(Edge i) const {return *(T*)0;}
   278       T &operator[](Edge i) {return *(T*)0;}
   216       T &operator[](Edge i) {return *(T*)0;}
   279     
   217     
   280       void update() {}
   218       void update() { }
   281       void update(T a) {}   //FIXME: Is it necessary
   219       //void update(T a) { }   //FIXME: Is it necessary
   282     };
   220     };
   283   };
   221   };
   284 
   222 
   285   /// An empty eraseable graph class.
   223 
   286   
   224   /// \brief Node-iterable graph concept.
   287   /// This class provides all the common features of an \e eraseable graph
   225   ///
   288   /// structure,
   226   /// A graph class which provides functions to 
   289   /// however completely without implementations and real data structures
   227   /// iterate on its nodes.
   290   /// behind the interface.
   228   class NodeIterableGraphConcept : virtual public GraphConcept
   291   /// All graph algorithms should compile with this class, but it will not
   229   {
   292   /// run properly, of course.
   230   public:
   293   ///
   231 
   294   /// \todo This blabla could be replaced by a sepatate description about
   232     /// \brief This iterator goes trough the nodes of the graph.
   295   /// Skeleturos.
   233     ///
   296   ///
   234     /// This iterator goes trough the \e nodes of the graph.
   297   /// It can be used for checking the interface compatibility,
   235     /// Its usage is quite simple, for example you can count the number
   298   /// or it can serve as a skeleton of a new graph structure.
   236     /// of nodes in graph \c g of type \c Graph as follows.
   299   /// 
   237     /// \code
   300   /// Also, you will find here the full documentation of a certain graph
   238     /// int count=0;
   301   /// feature, the documentation of a real graph imlementation
   239     /// for(Graph::NodeIt n(g); g.valid(n); g.next(n)) ++count;
   302   /// like @ref ListGraph or
   240     /// \endcode
   303   /// @ref SmartGraph will just refer to this structure.
   241     class NodeIt : public Node {
   304   class EraseableGraphSkeleturo : public GraphSkeleturo
   242     public:
   305   {
   243       /// @warning The default constructor sets the iterator.
   306   public:
   244       /// to an undefined value.
   307     /// Deletes a node.
   245       NodeIt() { }
   308     void erase(Node n) {}
   246       // /// Copy constructor
   309     /// Deletes an edge.
   247       //NodeIt(const NodeIt& n) { }
   310     void erase(Edge e) {}
   248       /// Initialize the iterator to be invalid.
   311 
   249       NodeIt(const Invalid&) { }
   312     /// Defalult constructor.
   250       /// \brief This constructor sets the iterator to first node.
   313     GraphSkeleturo() {}
   251       ///
   314     ///Copy consructor.
   252       /// This constructor set the iterator to the first 
   315     GraphSkeleturo(const GraphSkeleturo &G) {}
   253       /// node of the graph \c g.
   316   };
   254       ///
   317 
   255       ///@param g the graph
   318   /// An empty out-edge-iterable graph class.
   256       NodeIt(const GraphConcept& g) { }
   319   
   257     };
   320   /// An empty graph class which provides a function to 
   258 
       
   259     /// The first node.
       
   260     NodeIt &first(NodeIt &i) const { return i; }
       
   261 
       
   262     /// Go to the next node.
       
   263     NodeIt &next(NodeIt &i) const { return i; }
       
   264   };
       
   265 
       
   266 
       
   267   /// \brief Edge-iterable graph concept.
       
   268   ///
       
   269   /// A graph class which provides functions to 
       
   270   /// iterate on its edges.
       
   271   class EdgeIterableGraphConcept : virtual public GraphConcept
       
   272   {
       
   273   public:
       
   274 
       
   275     /// \brief This iterator goes trough the edges of the graph.
       
   276     ///
       
   277     /// This iterator goes trough the \e edges of the graph.
       
   278     /// Its usage is quite simple, for example you can count the number
       
   279     /// of edges in graph \c g of type \c Graph as follows.
       
   280     /// \code
       
   281     /// int count=0;
       
   282     /// for(Graph::EdgeIt e(g); g.valid(e); g.next(e)) ++count;
       
   283     /// \endcode
       
   284     class EdgeIt : public Edge {
       
   285     public:
       
   286       /// @warning The default constructor sets the iterator.
       
   287       /// to an undefined value.
       
   288       EdgeIt() { }
       
   289       // /// Copy constructor
       
   290       // EdgeIt(const EdgeIt&) { }
       
   291       /// Initialize the iterator to be invalid.
       
   292       EdgeIt(const Invalid&) { }
       
   293       /// \brief This constructor sets the iterator to first edge.
       
   294       ///
       
   295       /// This constructor set the iterator to the first 
       
   296       /// edge of the graph \c g.
       
   297       ///
       
   298       ///@param g the graph
       
   299       EdgeIt(const GraphConcept& g) { }
       
   300     };
       
   301 
       
   302     /// The first edge.
       
   303     EdgeIt &first(EdgeIt &i) const { return i; }
       
   304 
       
   305     /// Go to the next edge.
       
   306     EdgeIt &next(EdgeIt &i) const { return i; }
       
   307   };
       
   308 
       
   309 
       
   310   /// \brief Out-edge-iterable graph concept.
       
   311   ///
       
   312   /// A graph class which provides functions to 
   321   /// iterate on out-edges of any node.
   313   /// iterate on out-edges of any node.
   322   class OutEdgeIterableGraphSkeleturo : public GraphSkeleturo
   314   class OutEdgeIterableGraphConcept : virtual public GraphConcept
   323   {
   315   {
   324   public:
   316   public:
   325 
   317 
   326     /// This iterator goes trough the outgoing edges of a node.
   318     /// \brief This iterator goes trough the outgoing edges of a node.
   327 
   319     ///
   328     /// This iterator goes trough the \e outgoing edges of a certain node
   320     /// This iterator goes trough the \e outgoing edges of a certain node
   329     /// of a graph.
   321     /// of a graph.
   330     /// Its usage is quite simple, for example you can count the number
   322     /// Its usage is quite simple, for example you can count the number
   331     /// of outgoing edges of a node \c n
   323     /// of outgoing edges of a node \c n
   332     /// in graph \c G of type \c Graph as follows.
   324     /// in graph \c g of type \c Graph as follows.
   333     /// \code
   325     /// \code
   334     ///int count=0;
   326     /// int count=0;
   335     ///for(Graph::OutEdgeIt e(G,n); G.valid(e); G.next(e)) ++count;
   327     /// for(Graph::OutEdgeIt e(g, n); g.valid(e); g.next(e)) ++count;
   336     /// \endcode
   328     /// \endcode
   337     class OutEdgeIt : public Edge {
   329     class OutEdgeIt : public Edge {
   338     public:
   330     public:
   339       /// @warning The default constructor sets the iterator
   331       /// @warning The default constructor sets the iterator.
   340       /// to an undefined value.
   332       /// to an undefined value.
   341       OutEdgeIt() {}
   333       OutEdgeIt() { }
   342       /// Initialize the iterator to be invalid
   334       /// Initialize the iterator to be invalid.
   343       OutEdgeIt(Invalid) {}
   335       OutEdgeIt(const Invalid&) { }
   344       /// This constructor sets the iterator to first outgoing edge.
   336       /// \brief This constructor sets the iterator to first outgoing edge.
   345     
   337       ///
   346       /// This constructor set the iterator to the first outgoing edge of
   338       /// This constructor set the iterator to the first outgoing edge of
   347       /// node
   339       /// node
   348       ///@param n the node
   340       ///@param n the node
   349       ///@param G the graph
   341       ///@param g the graph
   350       OutEdgeIt(const GraphSkeleturo & G, Node n) {}
   342       OutEdgeIt(const GraphConcept& g, const Node& n) { }
   351     };
   343     };
   352   };
   344 
   353 
   345     /// The first outgoing edge.
   354   /// An empty in-edge-iterable graph class.
   346     OutEdgeIt &first(OutEdgeIt &i, const Node& n) const { return i; }
   355   
   347 
   356   /// An empty graph class which provides a function to 
   348     /// Go to the next outgoing edge.
       
   349     OutEdgeIt &next(OutEdgeIt &i) const { return i; }
       
   350 
       
   351     Node aNode(const OutEdgeIt&) const { return Node(); }
       
   352     Node bNode(const OutEdgeIt&) const { return Node(); }
       
   353   };
       
   354 
       
   355 
       
   356   /// \brief In-edge-iterable graph concept.
       
   357   ///
       
   358   /// A Graph class which provides a function to 
   357   /// iterate on in-edges of any node.
   359   /// iterate on in-edges of any node.
   358   class InEdgeIterableGraphSkeleturo : public GraphSkeleturo
   360   class InEdgeIterableGraphConcept : virtual public GraphConcept
   359   {
   361   {
   360   public:
   362   public:
   361 
   363 
   362     /// This iterator goes trough the incoming edges of a node.
   364     /// \brief This iterator goes trough the incoming edges of a node.
   363 
   365     /// 
   364     /// This iterator goes trough the \e incoming edges of a certain node
   366     /// This iterator goes trough the \e incoming edges of a certain node
   365     /// of a graph.
   367     /// of a graph.
   366     /// Its usage is quite simple, for example you can count the number
   368     /// Its usage is quite simple, for example you can count the number
   367     /// of incoming edges of a node \c n
   369     /// of incoming edges of a node \c n
   368     /// in graph \c G of type \c Graph as follows.
   370     /// in graph \c g of type \c Graph as follows.
   369     /// \code
   371     /// \code
   370     ///int count=0;
   372     /// int count=0;
   371     ///for(Graph::InEdgeIt e(G,n); G.valid(e); G.next(e)) ++count;
   373     /// for(Graph::InEdgeIt e(g, n); g.valid(e); g.next(e)) ++count;
   372     /// \endcode
   374     /// \endcode
   373     class InEdgeIt : public Edge {
   375     class InEdgeIt : public Edge {
   374     public:
   376     public:
   375       /// @warning The default constructor sets the iterator
   377       /// @warning The default constructor sets the iterator
   376       /// to an undefined value.
   378       /// to an undefined value.
   377       InEdgeIt() {}
   379       InEdgeIt() { }
   378       /// Initialize the iterator to be invalid
   380       /// Initialize the iterator to be invalid
   379       InEdgeIt(Invalid) {}
   381       InEdgeIt(const Invalid&) { }
   380       /// This constructor sets the iterator to first incomig edge.
   382       /// \brief This constructor sets the iterator to first incomig edge.
   381     
   383       /// 
   382       /// This constructor set the iterator to the first incomig edge of
   384       /// This constructor set the iterator to the first incomig edge of
   383       /// node
   385       /// node
   384       ///@param n the node
   386       ///@param n the node
   385       ///@param G the graph
   387       ///@param g the graph
   386       InEdgeIt(const GraphSkeleturo & G, Node n) {}
   388       InEdgeIt(const GraphConcept& g, const Node& n) { }
   387     };
   389     };
   388   };
   390 
   389 
   391     /// The first incoming edge.
   390 
   392     InEdgeIt &first(InEdgeIt &i, const Node& n) const { return i; }
   391   /// An empty node-eraseable graph class.
   393 
   392   
   394     /// Go to the next incoming edge.
   393   /// An empty graph class which provides a function to 
   395     InEdgeIt &next(InEdgeIt &i) const { return i; }
       
   396 
       
   397     Node aNode(const InEdgeIt&) const { return Node(); }
       
   398     Node bNode(const InEdgeIt&) const { return Node(); }
       
   399   };
       
   400 
       
   401 
       
   402   /// \brief Node-eraseable graph concept.
       
   403   ///
       
   404   /// A graph class which provides a function to 
   394   /// delete any of its nodes.
   405   /// delete any of its nodes.
   395   class NodeEraseableGraphSkeleturo : public GraphSkeleturo
   406   class NodeEraseableGraphConcept : virtual public GraphConcept
   396   {
   407   {
   397   public:
   408   public:
   398     /// Deletes a node.
   409     /// Deletes a node.
   399     void erase(Node n) {}
   410     void erase(const Node& n) { }
   400   };
   411   };
   401 
   412 
   402   /// An empty edge-eraseable graph class.
   413 
   403   
   414   /// \brief Edge-eraseable graph concept.
   404   /// An empty graph class which provides a function to delete any 
   415   /// 
       
   416   /// A graph class which provides a function to delete any 
   405   /// of its edges.
   417   /// of its edges.
   406   class EdgeEraseableGraphSkeleturo : public GraphSkeleturo
   418   class EdgeEraseableGraphConcept : virtual public GraphConcept
   407   {
   419   {
   408   public:
   420   public:
   409     /// Deletes a node.
   421     /// Deletes a node.
   410     void erase(Edge n) {}
   422     void erase(const Edge& n) { }
   411   };
   423   };
   412 
   424 
   413   /// An empty graph class which provides a function to get the number of its nodes.
   425 
   414   
   426   /// \brief An empty graph class which provides a function to 
       
   427   /// get the number of its nodes.
       
   428   /// 
   415   /// This graph class provides a function for getting the number of its 
   429   /// This graph class provides a function for getting the number of its 
   416   /// nodes. 
   430   /// nodes. 
   417   /// Clearly, for physical graph structures it can be expected to have such a 
   431   /// Clearly, for physical graph structures it can be expected to have such a 
   418   /// function. For wrappers or graphs which are given in an implicit way, 
   432   /// function. For wrappers or graphs which are given in an implicit way, 
   419   /// the implementation can be circumstantial, that is why this composes a 
   433   /// the implementation can be circumstantial, that is why this composes a 
   420   /// separate concept.
   434   /// separate concept.
   421   class NodeCountingGraphSkeleturo : public GraphSkeleturo
   435   class NodeCountingGraphConcept : virtual public GraphConcept
   422   {
   436   {
   423   public:
   437   public:
   424     /// Returns the number of nodes.
   438     /// Returns the number of nodes.
   425     int nodeNum() const { return 0;}
   439     int nodeNum() const { return 0; }
   426   };
   440   };
   427 
   441 
   428   /// An empty graph class which provides a function to get the number of its edges.
   442 
   429   
   443   /// \brief An empty graph class which provides a function to 
       
   444   /// get the number of its edges.
       
   445   /// 
   430   /// This graph class provides a function for getting the number of its 
   446   /// This graph class provides a function for getting the number of its 
   431   /// edges. 
   447   /// edges. 
   432   /// Clearly, for physical graph structures it can be expected to have such a 
   448   /// Clearly, for physical graph structures it can be expected to have such a 
   433   /// function. For wrappers or graphs which are given in an implicit way, 
   449   /// function. For wrappers or graphs which are given in an implicit way, 
   434   /// the implementation can be circumstantial, that is why this composes a 
   450   /// the implementation can be circumstantial, that is why this composes a 
   435   /// separate concept.
   451   /// separate concept.
   436   class EdgeCountingGraphSkeleturo : public GraphSkeleturo
   452   class EdgeCountingGraphConcept : virtual public GraphConcept
   437   {
   453   {
   438   public:
   454   public:
   439     /// Returns the number of edges.
   455     /// Returns the number of edges.
   440     int edgeNum() const { return 0;}
   456     int edgeNum() const { return 0; }
       
   457   };
       
   458 
       
   459   class FullFeatureGraphConcept : public NodeIterableGraphConcept,
       
   460 				  public EdgeIterableGraphConcept, 
       
   461 				  public OutEdgeIterableGraphConcept, 
       
   462 				  public InEdgeIterableGraphConcept {
       
   463   public:
       
   464     FullFeatureGraphConcept() { }
   441   };
   465   };
   442   
   466   
   443   /// @}
   467   /// @}
   444 
   468 
   445 } //namespace hugo
   469 } //namespace hugo
   446 
   470 
   447 
   471 
   448 
   472 
   449 // class EmptyBipGraph : public Graph Skeleturo
   473 // class EmptyBipGraph : public Graph Concept
   450 // {
   474 // {
   451 //   class ANode {};
   475 //   class ANode {};
   452 //   class BNode {};
   476 //   class BNode {};
   453 
   477 
   454 //   ANode &next(ANode &) {}
   478 //   ANode &next(ANode &) {}