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