src/lemon/concept/graph.h
author marci
Thu, 27 Jan 2005 17:44:04 +0000
changeset 1099 91a8ee9d088d
parent 989 ca95f8b5c931
child 1136 8d066154b66a
permissions -rw-r--r--
-=, - operators in expressions
klao@959
     1
/* -*- C++ -*-
klao@959
     2
 * src/lemon/concept/graph.h - Part of LEMON, a generic C++ optimization library
klao@959
     3
 *
klao@959
     4
 * Copyright (C) 2004 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
klao@959
     5
 * (Egervary Combinatorial Optimization Research Group, EGRES).
klao@959
     6
 *
klao@959
     7
 * Permission to use, modify and distribute this software is granted
klao@959
     8
 * provided that this copyright notice appears in all copies. For
klao@959
     9
 * precise terms see the accompanying LICENSE file.
klao@959
    10
 *
klao@959
    11
 * This software is provided "AS IS" with no warranty of any kind,
klao@959
    12
 * express or implied, and with no claim as to its suitability for any
klao@959
    13
 * purpose.
klao@959
    14
 *
klao@959
    15
 */
klao@959
    16
klao@959
    17
#ifndef LEMON_CONCEPT_GRAPH_H
klao@959
    18
#define LEMON_CONCEPT_GRAPH_H
klao@959
    19
klao@1030
    20
///\ingroup graph_concepts
klao@959
    21
///\file
klao@959
    22
///\brief Declaration of Graph.
klao@959
    23
klao@959
    24
#include <lemon/invalid.h>
klao@959
    25
#include <lemon/concept/maps.h>
klao@959
    26
#include <lemon/concept_check.h>
klao@959
    27
#include <lemon/concept/graph_component.h>
klao@959
    28
klao@959
    29
namespace lemon {
klao@959
    30
  namespace concept {
klao@959
    31
    
klao@1030
    32
    /// \addtogroup graph_concepts
klao@959
    33
    /// @{
klao@959
    34
klao@959
    35
//     /// An empty static graph class.
klao@959
    36
  
klao@959
    37
//     /// This class provides all the common features of a graph structure,
klao@959
    38
//     /// however completely without implementations and real data structures
klao@959
    39
//     /// behind the interface.
klao@959
    40
//     /// All graph algorithms should compile with this class, but it will not
klao@959
    41
//     /// run properly, of course.
klao@959
    42
//     ///
klao@959
    43
//     /// It can be used for checking the interface compatibility,
klao@959
    44
//     /// or it can serve as a skeleton of a new graph structure.
klao@959
    45
//     /// 
klao@959
    46
//     /// Also, you will find here the full documentation of a certain graph
klao@959
    47
//     /// feature, the documentation of a real graph imlementation
klao@959
    48
//     /// like @ref ListGraph or
klao@959
    49
//     /// @ref SmartGraph will just refer to this structure.
klao@959
    50
//     ///
klao@959
    51
//     /// \todo A pages describing the concept of concept description would
klao@959
    52
//     /// be nice.
klao@959
    53
//     class StaticGraph
klao@959
    54
//     {
klao@959
    55
//     public:
klao@959
    56
//       /// Defalult constructor.
klao@959
    57
klao@959
    58
//       /// Defalult constructor.
klao@959
    59
//       ///
klao@959
    60
//       StaticGraph() { }
klao@959
    61
//       ///Copy consructor.
klao@959
    62
klao@959
    63
// //       ///\todo It is not clear, what we expect from a copy constructor.
klao@959
    64
// //       ///E.g. How to assign the nodes/edges to each other? What about maps?
klao@959
    65
// //       StaticGraph(const StaticGraph& g) { }
klao@959
    66
klao@959
    67
//       /// The base type of node iterators, 
klao@959
    68
//       /// or in other words, the trivial node iterator.
klao@959
    69
klao@959
    70
//       /// This is the base type of each node iterator,
klao@959
    71
//       /// thus each kind of node iterator converts to this.
klao@959
    72
//       /// More precisely each kind of node iterator should be inherited 
klao@959
    73
//       /// from the trivial node iterator.
klao@959
    74
//       class Node {
klao@959
    75
//       public:
klao@959
    76
// 	/// Default constructor
klao@959
    77
klao@959
    78
// 	/// @warning The default constructor sets the iterator
klao@959
    79
// 	/// to an undefined value.
klao@959
    80
// 	Node() { }
klao@959
    81
// 	/// Copy constructor.
klao@959
    82
klao@959
    83
// 	/// Copy constructor.
klao@959
    84
// 	///
klao@959
    85
// 	Node(const Node&) { }
klao@959
    86
klao@959
    87
// 	/// Invalid constructor \& conversion.
klao@959
    88
klao@959
    89
// 	/// This constructor initializes the iterator to be invalid.
klao@959
    90
// 	/// \sa Invalid for more details.
klao@959
    91
// 	Node(Invalid) { }
klao@959
    92
// 	/// Equality operator
klao@959
    93
klao@959
    94
// 	/// Two iterators are equal if and only if they point to the
klao@959
    95
// 	/// same object or both are invalid.
klao@959
    96
// 	bool operator==(Node) const { return true; }
klao@959
    97
klao@959
    98
// 	/// Inequality operator
klao@959
    99
	
klao@959
   100
// 	/// \sa operator==(Node n)
klao@959
   101
// 	///
klao@959
   102
// 	bool operator!=(Node) const { return true; }
klao@959
   103
klao@959
   104
//       };
klao@959
   105
    
klao@959
   106
//       /// This iterator goes through each node.
klao@959
   107
klao@959
   108
//       /// This iterator goes through each node.
klao@959
   109
//       /// Its usage is quite simple, for example you can count the number
klao@959
   110
//       /// of nodes in graph \c g of type \c Graph like this:
klao@959
   111
//       /// \code
klao@959
   112
//       /// int count=0;
klao@959
   113
//       /// for (Graph::NodeIt n(g); n!=INVALID ++n) ++count;
klao@959
   114
//       /// \endcode
klao@959
   115
//       class NodeIt : public Node {
klao@959
   116
//       public:
klao@959
   117
// 	/// Default constructor
klao@959
   118
klao@959
   119
// 	/// @warning The default constructor sets the iterator
klao@959
   120
// 	/// to an undefined value.
klao@959
   121
// 	NodeIt() { }
klao@959
   122
// 	/// Copy constructor.
klao@959
   123
	
klao@959
   124
// 	/// Copy constructor.
klao@959
   125
// 	///
klao@959
   126
// 	NodeIt(const NodeIt&) { }
klao@959
   127
// 	/// Invalid constructor \& conversion.
klao@959
   128
klao@959
   129
// 	/// Initialize the iterator to be invalid.
klao@959
   130
// 	/// \sa Invalid for more details.
klao@959
   131
// 	NodeIt(Invalid) { }
klao@959
   132
// 	/// Sets the iterator to the first node.
klao@959
   133
klao@959
   134
// 	/// Sets the iterator to the first node of \c g.
klao@959
   135
// 	///
klao@959
   136
// 	NodeIt(const StaticGraph& g) { }
klao@959
   137
// 	/// Node -> NodeIt conversion.
klao@959
   138
klao@959
   139
// 	/// Sets the iterator to the node of \c g pointed by the trivial 
klao@959
   140
// 	/// iterator n.
klao@959
   141
// 	/// This feature necessitates that each time we 
klao@959
   142
// 	/// iterate the edge-set, the iteration order is the same.
klao@959
   143
// 	NodeIt(const StaticGraph& g, const Node& n) { }
klao@959
   144
// 	/// Next node.
klao@959
   145
klao@959
   146
// 	/// Assign the iterator to the next node.
klao@959
   147
// 	///
klao@959
   148
// 	NodeIt& operator++() { return *this; }
klao@959
   149
//       };
klao@959
   150
    
klao@959
   151
    
klao@959
   152
//       /// The base type of the edge iterators.
klao@959
   153
klao@959
   154
//       /// The base type of the edge iterators.
klao@959
   155
//       ///
klao@959
   156
//       class Edge {
klao@959
   157
//       public:
klao@959
   158
// 	/// Default constructor
klao@959
   159
klao@959
   160
// 	/// @warning The default constructor sets the iterator
klao@959
   161
// 	/// to an undefined value.
klao@959
   162
// 	Edge() { }
klao@959
   163
// 	/// Copy constructor.
klao@959
   164
klao@959
   165
// 	/// Copy constructor.
klao@959
   166
// 	///
klao@959
   167
// 	Edge(const Edge&) { }
klao@959
   168
// 	/// Initialize the iterator to be invalid.
klao@959
   169
klao@959
   170
// 	/// Initialize the iterator to be invalid.
klao@959
   171
// 	///
klao@959
   172
// 	Edge(Invalid) { }
klao@959
   173
// 	/// Equality operator
klao@959
   174
klao@959
   175
// 	/// Two iterators are equal if and only if they point to the
klao@959
   176
// 	/// same object or both are invalid.
klao@959
   177
// 	bool operator==(Edge) const { return true; }
klao@959
   178
// 	/// Inequality operator
klao@959
   179
klao@959
   180
// 	/// \sa operator==(Node n)
klao@959
   181
// 	///
klao@959
   182
// 	bool operator!=(Edge) const { return true; }
klao@959
   183
//       };
klao@959
   184
    
klao@959
   185
//       /// This iterator goes trough the outgoing edges of a node.
klao@959
   186
klao@959
   187
//       /// This iterator goes trough the \e outgoing edges of a certain node
klao@959
   188
//       /// of a graph.
klao@959
   189
//       /// Its usage is quite simple, for example you can count the number
klao@959
   190
//       /// of outgoing edges of a node \c n
klao@959
   191
//       /// in graph \c g of type \c Graph as follows.
klao@959
   192
//       /// \code
klao@959
   193
//       /// int count=0;
klao@959
   194
//       /// for (Graph::OutEdgeIt e(g, n); e!=INVALID; ++e) ++count;
klao@959
   195
//       /// \endcode
klao@959
   196
    
klao@959
   197
//       class OutEdgeIt : public Edge {
klao@959
   198
//       public:
klao@959
   199
// 	/// Default constructor
klao@959
   200
klao@959
   201
// 	/// @warning The default constructor sets the iterator
klao@959
   202
// 	/// to an undefined value.
klao@959
   203
// 	OutEdgeIt() { }
klao@959
   204
// 	/// Copy constructor.
klao@959
   205
klao@959
   206
// 	/// Copy constructor.
klao@959
   207
// 	///
klao@959
   208
// 	OutEdgeIt(const OutEdgeIt&) { }
klao@959
   209
// 	/// Initialize the iterator to be invalid.
klao@959
   210
klao@959
   211
// 	/// Initialize the iterator to be invalid.
klao@959
   212
// 	///
klao@959
   213
// 	OutEdgeIt(Invalid) { }
klao@959
   214
// 	/// This constructor sets the iterator to first outgoing edge.
klao@959
   215
    
klao@959
   216
// 	/// This constructor set the iterator to the first outgoing edge of
klao@959
   217
// 	/// node
klao@959
   218
// 	///@param n the node
klao@959
   219
// 	///@param g the graph
klao@959
   220
// 	OutEdgeIt(const StaticGraph& g, const Node& n) { }
klao@959
   221
// 	/// Edge -> OutEdgeIt conversion
klao@959
   222
klao@959
   223
// 	/// Sets the iterator to the value of the trivial iterator \c e.
klao@959
   224
// 	/// This feature necessitates that each time we 
klao@959
   225
// 	/// iterate the edge-set, the iteration order is the same.
klao@959
   226
// 	OutEdgeIt(const StaticGraph& g, const Edge& e) { }
klao@959
   227
// 	///Next outgoing edge
klao@959
   228
	
klao@959
   229
// 	/// Assign the iterator to the next 
klao@959
   230
// 	/// outgoing edge of the corresponding node.
klao@959
   231
// 	OutEdgeIt& operator++() { return *this; }
klao@959
   232
//       };
klao@959
   233
klao@959
   234
//       /// This iterator goes trough the incoming edges of a node.
klao@959
   235
klao@959
   236
//       /// This iterator goes trough the \e incoming edges of a certain node
klao@959
   237
//       /// of a graph.
klao@959
   238
//       /// Its usage is quite simple, for example you can count the number
klao@959
   239
//       /// of outgoing edges of a node \c n
klao@959
   240
//       /// in graph \c g of type \c Graph as follows.
klao@959
   241
//       /// \code
klao@959
   242
//       /// int count=0;
klao@959
   243
//       /// for(Graph::InEdgeIt e(g, n); e!=INVALID; ++e) ++count;
klao@959
   244
//       /// \endcode
klao@959
   245
klao@959
   246
//       class InEdgeIt : public Edge {
klao@959
   247
//       public:
klao@959
   248
// 	/// Default constructor
klao@959
   249
klao@959
   250
// 	/// @warning The default constructor sets the iterator
klao@959
   251
// 	/// to an undefined value.
klao@959
   252
// 	InEdgeIt() { }
klao@959
   253
// 	/// Copy constructor.
klao@959
   254
klao@959
   255
// 	/// Copy constructor.
klao@959
   256
// 	///
klao@959
   257
// 	InEdgeIt(const InEdgeIt&) { }
klao@959
   258
// 	/// Initialize the iterator to be invalid.
klao@959
   259
klao@959
   260
// 	/// Initialize the iterator to be invalid.
klao@959
   261
// 	///
klao@959
   262
// 	InEdgeIt(Invalid) { }
klao@959
   263
// 	/// This constructor sets the iterator to first incoming edge.
klao@959
   264
    
klao@959
   265
// 	/// This constructor set the iterator to the first incoming edge of
klao@959
   266
// 	/// node
klao@959
   267
// 	///@param n the node
klao@959
   268
// 	///@param g the graph
klao@959
   269
// 	InEdgeIt(const StaticGraph& g, const Node& n) { }
klao@959
   270
// 	/// Edge -> InEdgeIt conversion
klao@959
   271
klao@959
   272
// 	/// Sets the iterator to the value of the trivial iterator \c e.
klao@959
   273
// 	/// This feature necessitates that each time we 
klao@959
   274
// 	/// iterate the edge-set, the iteration order is the same.
klao@959
   275
// 	InEdgeIt(const StaticGraph& g, const Edge& n) { }
klao@959
   276
// 	/// Next incoming edge
klao@959
   277
klao@959
   278
// 	/// Assign the iterator to the next inedge of the corresponding node.
klao@959
   279
// 	///
klao@959
   280
// 	InEdgeIt& operator++() { return *this; }
klao@959
   281
//       };
klao@959
   282
//       /// This iterator goes through each edge.
klao@959
   283
klao@959
   284
//       /// This iterator goes through each edge of a graph.
klao@959
   285
//       /// Its usage is quite simple, for example you can count the number
klao@959
   286
//       /// of edges in a graph \c g of type \c Graph as follows:
klao@959
   287
//       /// \code
klao@959
   288
//       /// int count=0;
klao@959
   289
//       /// for(Graph::EdgeIt e(g); e!=INVALID; ++e) ++count;
klao@959
   290
//       /// \endcode
klao@959
   291
//       class EdgeIt : public Edge {
klao@959
   292
//       public:
klao@959
   293
// 	/// Default constructor
klao@959
   294
klao@959
   295
// 	/// @warning The default constructor sets the iterator
klao@959
   296
// 	/// to an undefined value.
klao@959
   297
// 	EdgeIt() { }
klao@959
   298
// 	/// Copy constructor.
klao@959
   299
klao@959
   300
// 	/// Copy constructor.
klao@959
   301
// 	///
klao@959
   302
// 	EdgeIt(const EdgeIt&) { }
klao@959
   303
// 	/// Initialize the iterator to be invalid.
klao@959
   304
klao@959
   305
// 	/// Initialize the iterator to be invalid.
klao@959
   306
// 	///
klao@959
   307
// 	EdgeIt(Invalid) { }
klao@959
   308
// 	/// This constructor sets the iterator to first edge.
klao@959
   309
    
klao@959
   310
// 	/// This constructor set the iterator to the first edge of
klao@959
   311
// 	/// node
klao@959
   312
// 	///@param g the graph
klao@959
   313
// 	EdgeIt(const StaticGraph& g) { }
klao@959
   314
// 	/// Edge -> EdgeIt conversion
klao@959
   315
klao@959
   316
// 	/// Sets the iterator to the value of the trivial iterator \c e.
klao@959
   317
// 	/// This feature necessitates that each time we 
klao@959
   318
// 	/// iterate the edge-set, the iteration order is the same.
klao@959
   319
// 	EdgeIt(const StaticGraph&, const Edge&) { } 
klao@959
   320
//     	///Next edge
klao@959
   321
	
klao@959
   322
// 	/// Assign the iterator to the next 
klao@959
   323
// 	/// edge of the corresponding node.
klao@959
   324
// 	EdgeIt& operator++() { return *this; }
klao@959
   325
//       };
alpar@986
   326
//       ///Gives back the target node of an edge.
klao@959
   327
alpar@986
   328
//       ///Gives back the target node of an edge.
klao@959
   329
//       ///
alpar@986
   330
//       Node target(Edge) const { return INVALID; }
alpar@986
   331
//       ///Gives back the source node of an edge.
klao@959
   332
alpar@986
   333
//       ///Gives back the source node of an edge.
klao@959
   334
//       ///
alpar@986
   335
//       Node source(Edge) const { return INVALID; }
deba@989
   336
//       /// Read write map of the nodes to type \c T.
klao@959
   337
klao@959
   338
//       /// \ingroup concept
deba@989
   339
//       /// ReadWrite map of the nodes to type \c T.
klao@959
   340
//       /// \sa Reference
klao@959
   341
//       /// \warning Making maps that can handle bool type (NodeMap<bool>)
klao@959
   342
//       /// needs some extra attention!
deba@989
   343
//       template<class T> 
deba@989
   344
//       class NodeMap : public ReadWriteMap< Node, T >
klao@959
   345
//       {
klao@959
   346
//       public:
klao@959
   347
klao@959
   348
// 	///\e
klao@959
   349
// 	NodeMap(const StaticGraph&) { }
klao@959
   350
// 	///\e
klao@959
   351
// 	NodeMap(const StaticGraph&, T) { }
klao@959
   352
klao@959
   353
// 	///Copy constructor
deba@989
   354
// 	NodeMap(const NodeMap&) { }
klao@959
   355
// 	///Assignment operator
deba@989
   356
// 	NodeMap& operator=(const NodeMap&) { return *this; }
deba@989
   357
// 	// \todo fix this concept
klao@959
   358
//       };
klao@959
   359
deba@989
   360
//       /// Read write map of the edges to type \c T.
klao@959
   361
klao@959
   362
//       /// \ingroup concept
klao@959
   363
//       ///Reference map of the edges to type \c T.
klao@959
   364
//       /// \sa Reference
klao@959
   365
//       /// \warning Making maps that can handle bool type (EdgeMap<bool>)
klao@959
   366
//       /// needs some extra attention!
deba@989
   367
//       template<class T> 
deba@989
   368
//       class EdgeMap : public ReadWriteMap<Edge,T>
klao@959
   369
//       {
klao@959
   370
//       public:
klao@959
   371
klao@959
   372
// 	///\e
klao@959
   373
// 	EdgeMap(const StaticGraph&) { }
klao@959
   374
// 	///\e
klao@959
   375
// 	EdgeMap(const StaticGraph&, T) { }
klao@959
   376
// 	///Copy constructor
deba@989
   377
// 	EdgeMap(const EdgeMap&) { }
klao@959
   378
// 	///Assignment operator
deba@989
   379
// 	EdgeMap& operator=(const EdgeMap&) { return *this; }
deba@989
   380
// 	// \todo fix this concept    
klao@959
   381
//       };
klao@959
   382
//     };
klao@959
   383
klao@959
   384
//     /// An empty non-static graph class.
klao@959
   385
    
klao@959
   386
//     /// This class provides everything that \ref StaticGraph
klao@959
   387
//     /// with additional functionality which enables to build a
klao@959
   388
//     /// graph from scratch.
klao@959
   389
//     class ExtendableGraph : public StaticGraph
klao@959
   390
//     {
klao@959
   391
//     public:
klao@959
   392
//       /// Defalult constructor.
klao@959
   393
klao@959
   394
//       /// Defalult constructor.
klao@959
   395
//       ///
klao@959
   396
//       ExtendableGraph() { }
klao@959
   397
//       ///Add a new node to the graph.
klao@959
   398
klao@959
   399
//       /// \return the new node.
klao@959
   400
//       ///
klao@959
   401
//       Node addNode() { return INVALID; }
klao@959
   402
//       ///Add a new edge to the graph.
klao@959
   403
deba@989
   404
//       ///Add a new edge to the graph with source node \c s
deba@989
   405
//       ///and target node \c t.
klao@959
   406
//       ///\return the new edge.
deba@989
   407
//       Edge addEdge(Node s, Node t) { return INVALID; }
klao@959
   408
    
klao@959
   409
//       /// Resets the graph.
klao@959
   410
klao@959
   411
//       /// This function deletes all edges and nodes of the graph.
klao@959
   412
//       /// It also frees the memory allocated to store them.
klao@959
   413
//       /// \todo It might belong to \ref ErasableGraph.
klao@959
   414
//       void clear() { }
klao@959
   415
//     };
klao@959
   416
klao@959
   417
//     /// An empty erasable graph class.
klao@959
   418
  
klao@959
   419
//     /// This class is an extension of \ref ExtendableGraph. It also makes it
klao@959
   420
//     /// possible to erase edges or nodes.
klao@959
   421
//     class ErasableGraph : public ExtendableGraph
klao@959
   422
//     {
klao@959
   423
//     public:
klao@959
   424
//       /// Defalult constructor.
klao@959
   425
klao@959
   426
//       /// Defalult constructor.
klao@959
   427
//       ///
klao@959
   428
//       ErasableGraph() { }
klao@959
   429
//       /// Deletes a node.
klao@959
   430
klao@959
   431
//       /// Deletes node \c n node.
klao@959
   432
//       ///
klao@959
   433
//       void erase(Node n) { }
klao@959
   434
//       /// Deletes an edge.
klao@959
   435
klao@959
   436
//       /// Deletes edge \c e edge.
klao@959
   437
//       ///
klao@959
   438
//       void erase(Edge e) { }
klao@959
   439
//     };
deba@989
   440
klao@959
   441
    
klao@959
   442
    /************* New GraphBase stuff **************/
klao@959
   443
klao@959
   444
klao@959
   445
    /// A minimal GraphBase concept
klao@959
   446
klao@959
   447
    /// This class describes a minimal concept which can be extended to a
klao@959
   448
    /// full-featured graph with \ref GraphFactory.
klao@959
   449
    class GraphBase {
klao@959
   450
    public:
klao@959
   451
klao@959
   452
      GraphBase() {}
klao@959
   453
klao@961
   454
      /// \bug Should we demand that Node and Edge be subclasses of the
klao@961
   455
      /// Graph class???
klao@959
   456
klao@961
   457
      typedef GraphItem<'n'> Node;
klao@961
   458
      typedef GraphItem<'e'> Edge;
klao@961
   459
klao@961
   460
//       class Node : public BaseGraphItem<'n'> {};
klao@961
   461
//       class Edge : public BaseGraphItem<'e'> {};
klao@959
   462
klao@959
   463
      // Graph operation
klao@959
   464
      void firstNode(Node &n) const { }
klao@959
   465
      void firstEdge(Edge &e) const { }
klao@959
   466
klao@959
   467
      void firstOutEdge(Edge &e, Node) const { }
klao@959
   468
      void firstInEdge(Edge &e, Node) const { }
klao@959
   469
klao@959
   470
      void nextNode(Node &n) const { }
klao@959
   471
      void nextEdge(Edge &e) const { }
klao@959
   472
klao@959
   473
klao@959
   474
      // Question: isn't it reasonable if this methods have a Node
klao@959
   475
      // parameter? Like this:
klao@959
   476
      // Edge& nextOut(Edge &e, Node) const { return e; }
klao@959
   477
      void nextOutEdge(Edge &e) const { }
klao@959
   478
      void nextInEdge(Edge &e) const { }
klao@959
   479
alpar@986
   480
      Node target(Edge) const { return Node(); }
alpar@986
   481
      Node source(Edge) const { return Node(); }
klao@959
   482
      
klao@959
   483
klao@959
   484
      // Do we need id, nodeNum, edgeNum and co. in this basic graphbase
klao@959
   485
      // concept?
klao@959
   486
klao@959
   487
klao@959
   488
      // Maps.
klao@959
   489
      //
klao@959
   490
      // We need a special slimer concept which does not provide maps (it
klao@959
   491
      // wouldn't be strictly slimer, cause for map-factory id() & friends
klao@959
   492
      // a required...)
klao@959
   493
klao@959
   494
      template<typename T>
deba@989
   495
      class NodeMap : public GraphMap<GraphBase, Node, T> {};
klao@959
   496
klao@959
   497
      template<typename T>
deba@989
   498
      class EdgeMap : public GraphMap<GraphBase, Node, T> {};
klao@959
   499
    };
klao@959
   500
klao@959
   501
klao@959
   502
klao@959
   503
klao@961
   504
    /**************** The full-featured graph concepts ****************/
klao@959
   505
klao@959
   506
    
klao@959
   507
    class StaticGraph 
klao@961
   508
      :  virtual public BaseGraphComponent,
klao@961
   509
	 public IterableGraphComponent, public MappableGraphComponent {
klao@959
   510
    public:
klao@959
   511
      typedef BaseGraphComponent::Node Node;
klao@959
   512
      typedef BaseGraphComponent::Edge Edge;
klao@959
   513
deba@989
   514
      template <typename _Graph>
deba@989
   515
      struct Constraints {
deba@989
   516
	void constraints() {
deba@989
   517
	  checkConcept<IterableGraphComponent, _Graph>();
deba@989
   518
	  checkConcept<MappableGraphComponent, _Graph>();
deba@989
   519
	}
deba@989
   520
      };
klao@959
   521
    };
klao@959
   522
klao@959
   523
    class ExtendableGraph 
klao@961
   524
      :  virtual public BaseGraphComponent, public StaticGraph,
klao@961
   525
	 public ExtendableGraphComponent, public ClearableGraphComponent {
klao@959
   526
    public:
klao@959
   527
      typedef BaseGraphComponent::Node Node;
klao@959
   528
      typedef BaseGraphComponent::Edge Edge;
klao@959
   529
deba@989
   530
      template <typename _Graph>
deba@989
   531
      struct Constraints {
deba@989
   532
	void constraints() {
deba@989
   533
	  checkConcept<StaticGraph, _Graph >();
deba@989
   534
	  checkConcept<ExtendableGraphComponent, _Graph >();
deba@989
   535
	  checkConcept<ClearableGraphComponent, _Graph >();
deba@989
   536
	}
deba@989
   537
      };
klao@959
   538
    };
klao@959
   539
klao@959
   540
    class ErasableGraph 
klao@961
   541
      :  virtual public BaseGraphComponent, public ExtendableGraph,
klao@961
   542
	 public ErasableGraphComponent {
klao@959
   543
    public:
klao@959
   544
      typedef BaseGraphComponent::Node Node;
klao@959
   545
      typedef BaseGraphComponent::Edge Edge;
klao@959
   546
deba@989
   547
      template <typename _Graph>
deba@989
   548
      struct Constraints {
deba@989
   549
	void constraints() {
deba@989
   550
	  checkConcept<ExtendableGraph, _Graph >();
deba@989
   551
	  checkConcept<ErasableGraphComponent, _Graph >();
deba@989
   552
	}
deba@989
   553
      };
klao@959
   554
    };
klao@959
   555
klao@959
   556
    // @}
klao@959
   557
  } //namespace concept  
klao@959
   558
} //namespace lemon
klao@959
   559
klao@959
   560
klao@959
   561
klao@959
   562
#endif // LEMON_CONCEPT_GRAPH_H