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