lemon/concept/undir_graph.h
author alpar
Tue, 16 Aug 2005 16:42:04 +0000
changeset 1629 a245eff568a6
parent 1624 61cc647dac99
child 1630 f67737f5727a
permissions -rw-r--r--
lp.h added
klao@962
     1
/* -*- C++ -*-
klao@962
     2
 *
ladanyi@1435
     3
 * lemon/concept/undir_graph_component.h - Part of LEMON, a generic
klao@962
     4
 * C++ optimization library
klao@962
     5
 *
alpar@1164
     6
 * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi
alpar@1359
     7
 * Kutatocsoport (Egervary Research Group on Combinatorial Optimization,
klao@962
     8
 * EGRES).
klao@962
     9
 *
klao@962
    10
 * Permission to use, modify and distribute this software is granted
klao@962
    11
 * provided that this copyright notice appears in all copies. For
klao@962
    12
 * precise terms see the accompanying LICENSE file.
klao@962
    13
 *
klao@962
    14
 * This software is provided "AS IS" with no warranty of any kind,
klao@962
    15
 * express or implied, and with no claim as to its suitability for any
klao@962
    16
 * purpose.
klao@962
    17
 *
klao@962
    18
 */
klao@962
    19
klao@1030
    20
///\ingroup graph_concepts
klao@962
    21
///\file
klao@962
    22
///\brief Undirected graphs and components of.
klao@962
    23
klao@962
    24
klao@962
    25
#ifndef LEMON_CONCEPT_UNDIR_GRAPH_H
klao@962
    26
#define LEMON_CONCEPT_UNDIR_GRAPH_H
klao@962
    27
klao@962
    28
#include <lemon/concept/graph_component.h>
alpar@1620
    29
#include <lemon/concept/graph.h>
alpar@1448
    30
#include <lemon/utility.h>
klao@962
    31
klao@962
    32
namespace lemon {
klao@962
    33
  namespace concept {
klao@962
    34
klao@1030
    35
    /// Skeleton class which describes an edge with direction in \ref
klao@1030
    36
    /// UndirGraph "undirected graph".
klao@1158
    37
    template <typename UndirGraph>
klao@1158
    38
    class UndirGraphEdge : public UndirGraph::UndirEdge {
klao@1158
    39
      typedef typename UndirGraph::UndirEdge UndirEdge;
klao@1158
    40
      typedef typename UndirGraph::Node Node;
klao@1030
    41
    public:
klao@1030
    42
klao@1030
    43
      /// \e
klao@1030
    44
      UndirGraphEdge() {}
klao@1030
    45
klao@1030
    46
      /// \e
alpar@1367
    47
      UndirGraphEdge(const UndirGraphEdge& e) : UndirGraph::UndirEdge(e) {}
klao@1030
    48
klao@1030
    49
      /// \e
klao@1030
    50
      UndirGraphEdge(Invalid) {}
klao@1030
    51
klao@1158
    52
      /// \brief Directed edge from undirected edge and a source node.
klao@1030
    53
      ///
klao@1158
    54
      /// Constructs a directed edge from undirected edge and a source node.
klao@1158
    55
      ///
klao@1158
    56
      /// \note You have to specify the graph for this constructor.
klao@1158
    57
      UndirGraphEdge(const UndirGraph &g,
klao@1158
    58
		     UndirEdge undir_edge, Node n) {
klao@1030
    59
	ignore_unused_variable_warning(undir_edge);
klao@1158
    60
	ignore_unused_variable_warning(g);
klao@1158
    61
	ignore_unused_variable_warning(n);
klao@1030
    62
      }
klao@1030
    63
klao@1030
    64
      /// \e
klao@1030
    65
      UndirGraphEdge& operator=(UndirGraphEdge) { return *this; }
klao@1030
    66
klao@1030
    67
      /// \e
klao@1030
    68
      bool operator==(UndirGraphEdge) const { return true; }
klao@1030
    69
      /// \e
klao@1030
    70
      bool operator!=(UndirGraphEdge) const { return false; }
klao@1030
    71
klao@1030
    72
      /// \e
klao@1030
    73
      bool operator<(UndirGraphEdge) const { return false; }
klao@1030
    74
klao@1030
    75
      template <typename Edge>
klao@1030
    76
      struct Constraints {
klao@1030
    77
	void constraints() {
klao@1158
    78
	  const_constraints();
klao@1158
    79
	}
klao@1158
    80
	void const_constraints() const {
klao@1030
    81
	  /// \bug This should be is_base_and_derived ...
klao@1030
    82
	  UndirEdge ue = e;
klao@1030
    83
	  ue = e;
klao@1030
    84
klao@1158
    85
	  Edge e_with_source(graph,ue,n);
klao@1158
    86
	  ignore_unused_variable_warning(e_with_source);
klao@1030
    87
	}
klao@1030
    88
	Edge e;
klao@1158
    89
	UndirEdge ue;
klao@1158
    90
	UndirGraph graph;
klao@1158
    91
	Node n;
klao@1030
    92
      };
klao@1030
    93
    };
klao@1030
    94
    
klao@962
    95
klao@962
    96
    struct BaseIterableUndirGraphConcept {
deba@989
    97
klao@1022
    98
      template <typename Graph>
klao@1022
    99
      struct Constraints {
klao@962
   100
klao@1022
   101
	typedef typename Graph::UndirEdge UndirEdge;
klao@1022
   102
	typedef typename Graph::Edge Edge;
klao@1022
   103
	typedef typename Graph::Node Node;
klao@962
   104
klao@1022
   105
	void constraints() {
klao@1022
   106
	  checkConcept<BaseIterableGraphComponent, Graph>();
klao@1030
   107
	  checkConcept<GraphItem<>, UndirEdge>();
alpar@1620
   108
	  //checkConcept<UndirGraphEdge<Graph>, Edge>();
klao@962
   109
klao@1030
   110
	  graph.first(ue);
klao@1030
   111
	  graph.next(ue);
klao@1022
   112
klao@1030
   113
	  const_constraints();
klao@1030
   114
	}
klao@1030
   115
	void const_constraints() {
klao@1022
   116
	  Node n;
klao@1022
   117
	  n = graph.target(ue);
klao@1022
   118
	  n = graph.source(ue);
klao@1030
   119
	  n = graph.oppositeNode(n0, ue);
klao@1022
   120
klao@1030
   121
	  bool b;
deba@1627
   122
	  b = graph.direction(e);
deba@1627
   123
	  Edge e = graph.direct(UndirEdge(), true);
deba@1627
   124
	  e = graph.direct(UndirEdge(), n);
deba@1627
   125
 
klao@1030
   126
	  ignore_unused_variable_warning(b);
klao@1022
   127
	}
klao@1030
   128
klao@1030
   129
	Graph graph;
klao@1022
   130
	Edge e;
klao@1030
   131
	Node n0;
klao@1030
   132
	UndirEdge ue;
klao@1022
   133
      };
klao@1022
   134
klao@962
   135
    };
klao@962
   136
klao@1022
   137
klao@962
   138
    struct IterableUndirGraphConcept {
klao@962
   139
klao@1022
   140
      template <typename Graph>
klao@1022
   141
      struct Constraints {
klao@1022
   142
	void constraints() {
klao@1022
   143
	  /// \todo we don't need the iterable component to be base iterable
klao@1022
   144
	  /// Don't we really???
klao@1022
   145
	  //checkConcept< BaseIterableUndirGraphConcept, Graph > ();
klao@962
   146
klao@1022
   147
	  checkConcept<IterableGraphComponent, Graph> ();
klao@1021
   148
klao@1022
   149
	  typedef typename Graph::UndirEdge UndirEdge;
klao@1022
   150
	  typedef typename Graph::UndirEdgeIt UndirEdgeIt;
klao@1030
   151
	  typedef typename Graph::IncEdgeIt IncEdgeIt;
klao@1022
   152
klao@1022
   153
	  checkConcept<GraphIterator<Graph, UndirEdge>, UndirEdgeIt>();
klao@1030
   154
	  checkConcept<GraphIncIterator<Graph, UndirEdge>, IncEdgeIt>();
klao@1022
   155
	}
klao@1022
   156
      };
klao@1022
   157
klao@1022
   158
    };
klao@1022
   159
klao@1022
   160
    struct MappableUndirGraphConcept {
klao@1022
   161
klao@1022
   162
      template <typename Graph>
klao@1022
   163
      struct Constraints {
klao@1022
   164
klao@1022
   165
	struct Dummy {
klao@1022
   166
	  int value;
klao@1022
   167
	  Dummy() : value(0) {}
klao@1022
   168
	  Dummy(int _v) : value(_v) {}
klao@1022
   169
	};
klao@1022
   170
klao@1022
   171
	void constraints() {
klao@1022
   172
	  checkConcept<MappableGraphComponent, Graph>();
klao@1022
   173
klao@1022
   174
	  typedef typename Graph::template UndirEdgeMap<int> IntMap;
klao@1022
   175
	  checkConcept<GraphMap<Graph, typename Graph::UndirEdge, int>,
klao@1022
   176
	    IntMap >();
klao@1022
   177
klao@1022
   178
	  typedef typename Graph::template UndirEdgeMap<bool> BoolMap;
klao@1022
   179
	  checkConcept<GraphMap<Graph, typename Graph::UndirEdge, bool>,
klao@1022
   180
	    BoolMap >();
klao@1022
   181
klao@1022
   182
	  typedef typename Graph::template UndirEdgeMap<Dummy> DummyMap;
klao@1022
   183
	  checkConcept<GraphMap<Graph, typename Graph::UndirEdge, Dummy>,
klao@1022
   184
	    DummyMap >();
klao@1022
   185
	}
klao@1022
   186
      };
klao@1022
   187
klao@1022
   188
    };
klao@1022
   189
klao@1022
   190
    struct ExtendableUndirGraphConcept {
klao@1022
   191
klao@1022
   192
      template <typename Graph>
klao@1022
   193
      struct Constraints {
klao@1022
   194
	void constraints() {
klao@1022
   195
	  node_a = graph.addNode();
klao@1022
   196
	  uedge = graph.addEdge(node_a, node_b);
klao@1022
   197
	}
klao@1022
   198
	typename Graph::Node node_a, node_b;
klao@1022
   199
	typename Graph::UndirEdge uedge;
klao@1022
   200
	Graph graph;
klao@1022
   201
      };
klao@1022
   202
klao@1022
   203
    };
klao@1022
   204
klao@1022
   205
    struct ErasableUndirGraphConcept {
klao@1022
   206
klao@1022
   207
      template <typename Graph>
klao@1022
   208
      struct Constraints {
klao@1022
   209
	void constraints() {
klao@1022
   210
	  graph.erase(n);
klao@1022
   211
	  graph.erase(e);
klao@1022
   212
	}
klao@1022
   213
	Graph graph;
klao@1022
   214
	typename Graph::Node n;
klao@1022
   215
	typename Graph::UndirEdge e;
klao@1022
   216
      };
klao@1022
   217
klao@1022
   218
    };
klao@1022
   219
alpar@1620
   220
    /// \addtogroup graph_concepts
alpar@1620
   221
    /// @{
alpar@1620
   222
alpar@1620
   223
klao@1030
   224
    /// Class describing the concept of Undirected Graphs.
klao@1030
   225
klao@1030
   226
    /// This class describes the common interface of all Undirected
klao@1030
   227
    /// Graphs.
klao@1030
   228
    ///
klao@1030
   229
    /// As all concept describing classes it provides only interface
klao@1030
   230
    /// without any sensible implementation. So any algorithm for
klao@1030
   231
    /// undirected graph should compile with this class, but it will not
klao@1030
   232
    /// run properly, of couse.
klao@1030
   233
    ///
klao@1030
   234
    /// In LEMON undirected graphs also fulfill the concept of directed
klao@1030
   235
    /// graphs (\ref lemon::concept::Graph "Graph Concept"). For
klao@1030
   236
    /// explanation of this and more see also the page \ref undir_graphs,
klao@1030
   237
    /// a tutorial about undirected graphs.
deba@1627
   238
    ///
deba@1627
   239
    /// You can assume that all undirected graph can be handled
deba@1627
   240
    /// as a static directed graph. This way it is fully conform
deba@1627
   241
    /// to the StaticGraph concept.
klao@1030
   242
deba@1627
   243
    class UndirGraph {
klao@1022
   244
    public:
alpar@1448
   245
      ///\e
alpar@1448
   246
alpar@1448
   247
      ///\todo undocumented
alpar@1448
   248
      ///
alpar@1448
   249
      typedef True UndirTag;
klao@1022
   250
deba@1627
   251
      /// The base type of node iterators, 
deba@1627
   252
      /// or in other words, the trivial node iterator.
deba@1627
   253
deba@1627
   254
      /// This is the base type of each node iterator,
deba@1627
   255
      /// thus each kind of node iterator converts to this.
deba@1627
   256
      /// More precisely each kind of node iterator should be inherited 
deba@1627
   257
      /// from the trivial node iterator.
deba@1627
   258
      class Node {
deba@1627
   259
      public:
deba@1627
   260
        /// Default constructor
deba@1627
   261
deba@1627
   262
        /// @warning The default constructor sets the iterator
deba@1627
   263
        /// to an undefined value.
deba@1627
   264
        Node() { }
deba@1627
   265
        /// Copy constructor.
deba@1627
   266
deba@1627
   267
        /// Copy constructor.
deba@1627
   268
        ///
deba@1627
   269
        Node(const Node&) { }
deba@1627
   270
deba@1627
   271
        /// Invalid constructor \& conversion.
deba@1627
   272
deba@1627
   273
        /// This constructor initializes the iterator to be invalid.
deba@1627
   274
        /// \sa Invalid for more details.
deba@1627
   275
        Node(Invalid) { }
deba@1627
   276
        /// Equality operator
deba@1627
   277
deba@1627
   278
        /// Two iterators are equal if and only if they point to the
deba@1627
   279
        /// same object or both are invalid.
deba@1627
   280
        bool operator==(Node) const { return true; }
deba@1627
   281
deba@1627
   282
        /// Inequality operator
deba@1627
   283
        
deba@1627
   284
        /// \sa operator==(Node n)
deba@1627
   285
        ///
deba@1627
   286
        bool operator!=(Node) const { return true; }
deba@1627
   287
deba@1627
   288
	/// Artificial ordering operator.
deba@1627
   289
	
deba@1627
   290
	/// To allow the use of graph descriptors as key type in std::map or
deba@1627
   291
	/// similar associative container we require this.
deba@1627
   292
	///
deba@1627
   293
	/// \note This operator only have to define some strict ordering of
deba@1627
   294
	/// the items; this order has nothing to do with the iteration
deba@1627
   295
	/// ordering of the items.
deba@1627
   296
	///
deba@1627
   297
	/// \bug This is a technical requirement. Do we really need this?
deba@1627
   298
	bool operator<(Node) const { return false; }
deba@1627
   299
deba@1627
   300
      };
deba@1627
   301
    
deba@1627
   302
      /// This iterator goes through each node.
deba@1627
   303
deba@1627
   304
      /// This iterator goes through each node.
deba@1627
   305
      /// Its usage is quite simple, for example you can count the number
deba@1627
   306
      /// of nodes in graph \c g of type \c Graph like this:
deba@1627
   307
      /// \code
deba@1627
   308
      /// int count=0;
deba@1627
   309
      /// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count;
deba@1627
   310
      /// \endcode
deba@1627
   311
      class NodeIt : public Node {
deba@1627
   312
      public:
deba@1627
   313
        /// Default constructor
deba@1627
   314
deba@1627
   315
        /// @warning The default constructor sets the iterator
deba@1627
   316
        /// to an undefined value.
deba@1627
   317
        NodeIt() { }
deba@1627
   318
        /// Copy constructor.
deba@1627
   319
        
deba@1627
   320
        /// Copy constructor.
deba@1627
   321
        ///
deba@1627
   322
        NodeIt(const NodeIt& n) : Node(n) { }
deba@1627
   323
        /// Invalid constructor \& conversion.
deba@1627
   324
deba@1627
   325
        /// Initialize the iterator to be invalid.
deba@1627
   326
        /// \sa Invalid for more details.
deba@1627
   327
        NodeIt(Invalid) { }
deba@1627
   328
        /// Sets the iterator to the first node.
deba@1627
   329
deba@1627
   330
        /// Sets the iterator to the first node of \c g.
deba@1627
   331
        ///
deba@1627
   332
        NodeIt(const UndirGraph&) { }
deba@1627
   333
        /// Node -> NodeIt conversion.
deba@1627
   334
deba@1627
   335
        /// Sets the iterator to the node of \c the graph pointed by 
deba@1627
   336
	/// the trivial iterator.
deba@1627
   337
        /// This feature necessitates that each time we 
deba@1627
   338
        /// iterate the edge-set, the iteration order is the same.
deba@1627
   339
        NodeIt(const UndirGraph&, const Node&) { }
deba@1627
   340
        /// Next node.
deba@1627
   341
deba@1627
   342
        /// Assign the iterator to the next node.
deba@1627
   343
        ///
deba@1627
   344
        NodeIt& operator++() { return *this; }
deba@1627
   345
      };
deba@1627
   346
    
deba@1627
   347
    
alpar@1620
   348
      /// The base type of the undirected edge iterators.
deba@1627
   349
alpar@1620
   350
      /// The base type of the undirected edge iterators.
alpar@1620
   351
      ///
alpar@1620
   352
      class UndirEdge {
alpar@1620
   353
      public:
alpar@1620
   354
        /// Default constructor
klao@1030
   355
alpar@1620
   356
        /// @warning The default constructor sets the iterator
alpar@1620
   357
        /// to an undefined value.
alpar@1620
   358
        UndirEdge() { }
alpar@1620
   359
        /// Copy constructor.
klao@1030
   360
alpar@1620
   361
        /// Copy constructor.
alpar@1620
   362
        ///
alpar@1620
   363
        UndirEdge(const UndirEdge&) { }
alpar@1620
   364
        /// Initialize the iterator to be invalid.
klao@1030
   365
alpar@1620
   366
        /// Initialize the iterator to be invalid.
alpar@1620
   367
        ///
alpar@1620
   368
        UndirEdge(Invalid) { }
alpar@1620
   369
        /// Equality operator
klao@1030
   370
alpar@1620
   371
        /// Two iterators are equal if and only if they point to the
alpar@1620
   372
        /// same object or both are invalid.
alpar@1620
   373
        bool operator==(UndirEdge) const { return true; }
alpar@1620
   374
        /// Inequality operator
klao@1030
   375
alpar@1620
   376
        /// \sa operator==(UndirEdge n)
alpar@1620
   377
        ///
alpar@1620
   378
        bool operator!=(UndirEdge) const { return true; }
klao@1030
   379
deba@1627
   380
	/// Artificial ordering operator.
deba@1627
   381
	
deba@1627
   382
	/// To allow the use of graph descriptors as key type in std::map or
deba@1627
   383
	/// similar associative container we require this.
deba@1627
   384
	///
deba@1627
   385
	/// \note This operator only have to define some strict ordering of
deba@1627
   386
	/// the items; this order has nothing to do with the iteration
deba@1627
   387
	/// ordering of the items.
deba@1627
   388
	///
deba@1627
   389
	/// \bug This is a technical requirement. Do we really need this?
deba@1627
   390
	bool operator<(UndirEdge) const { return false; }
deba@1627
   391
      };
klao@1030
   392
alpar@1620
   393
      /// This iterator goes through each undirected edge.
klao@1030
   394
alpar@1620
   395
      /// This iterator goes through each undirected edge of a graph.
alpar@1620
   396
      /// Its usage is quite simple, for example you can count the number
deba@1627
   397
      /// of undirected edges in a graph \c g of type \c Graph as follows:
alpar@1620
   398
      /// \code
alpar@1620
   399
      /// int count=0;
alpar@1620
   400
      /// for(Graph::UndirEdgeIt e(g); e!=INVALID; ++e) ++count;
alpar@1620
   401
      /// \endcode
alpar@1620
   402
      class UndirEdgeIt : public UndirEdge {
alpar@1620
   403
      public:
alpar@1620
   404
        /// Default constructor
deba@1627
   405
alpar@1620
   406
        /// @warning The default constructor sets the iterator
alpar@1620
   407
        /// to an undefined value.
alpar@1620
   408
        UndirEdgeIt() { }
alpar@1620
   409
        /// Copy constructor.
deba@1627
   410
alpar@1620
   411
        /// Copy constructor.
alpar@1620
   412
        ///
alpar@1620
   413
        UndirEdgeIt(const UndirEdgeIt& e) : UndirEdge(e) { }
alpar@1620
   414
        /// Initialize the iterator to be invalid.
klao@1030
   415
alpar@1620
   416
        /// Initialize the iterator to be invalid.
alpar@1620
   417
        ///
alpar@1620
   418
        UndirEdgeIt(Invalid) { }
deba@1627
   419
        /// This constructor sets the iterator to the first undirected edge.
alpar@1620
   420
    
deba@1627
   421
        /// This constructor sets the iterator to the first undirected edge.
alpar@1620
   422
        UndirEdgeIt(const UndirGraph&) { }
alpar@1620
   423
        /// UndirEdge -> UndirEdgeIt conversion
klao@1030
   424
deba@1627
   425
        /// Sets the iterator to the value of the trivial iterator.
deba@1627
   426
        /// This feature necessitates that each time we
deba@1627
   427
        /// iterate the undirected edge-set, the iteration order is the 
deba@1627
   428
	/// same.
alpar@1620
   429
        UndirEdgeIt(const UndirGraph&, const UndirEdge&) { } 
deba@1627
   430
        /// Next undirected edge
alpar@1620
   431
        
deba@1627
   432
        /// Assign the iterator to the next undirected edge.
alpar@1620
   433
        UndirEdgeIt& operator++() { return *this; }
alpar@1620
   434
      };
klao@1030
   435
deba@1627
   436
      /// \brief This iterator goes trough the incident undirected 
deba@1627
   437
      /// edges of a node.
deba@1627
   438
      ///
alpar@1620
   439
      /// This iterator goes trough the incident undirected edges
alpar@1620
   440
      /// of a certain node
alpar@1620
   441
      /// of a graph.
alpar@1620
   442
      /// Its usage is quite simple, for example you can compute the
alpar@1620
   443
      /// degree (i.e. count the number
alpar@1620
   444
      /// of incident edges of a node \c n
alpar@1620
   445
      /// in graph \c g of type \c Graph as follows.
alpar@1620
   446
      /// \code
alpar@1620
   447
      /// int count=0;
alpar@1620
   448
      /// for(Graph::IncEdgeIt e(g, n); e!=INVALID; ++e) ++count;
alpar@1620
   449
      /// \endcode
alpar@1620
   450
      class IncEdgeIt : public UndirEdge {
alpar@1620
   451
      public:
alpar@1620
   452
        /// Default constructor
klao@1030
   453
alpar@1620
   454
        /// @warning The default constructor sets the iterator
alpar@1620
   455
        /// to an undefined value.
alpar@1620
   456
        IncEdgeIt() { }
alpar@1620
   457
        /// Copy constructor.
alpar@1620
   458
alpar@1620
   459
        /// Copy constructor.
alpar@1620
   460
        ///
alpar@1620
   461
        IncEdgeIt(const IncEdgeIt& e) : UndirEdge(e) { }
alpar@1620
   462
        /// Initialize the iterator to be invalid.
alpar@1620
   463
alpar@1620
   464
        /// Initialize the iterator to be invalid.
alpar@1620
   465
        ///
alpar@1620
   466
        IncEdgeIt(Invalid) { }
alpar@1620
   467
        /// This constructor sets the iterator to first incident edge.
alpar@1620
   468
    
alpar@1620
   469
        /// This constructor set the iterator to the first incident edge of
alpar@1620
   470
        /// the node.
alpar@1620
   471
        IncEdgeIt(const UndirGraph&, const Node&) { }
alpar@1620
   472
        /// UndirEdge -> IncEdgeIt conversion
alpar@1620
   473
alpar@1620
   474
        /// Sets the iterator to the value of the trivial iterator \c e.
alpar@1620
   475
        /// This feature necessitates that each time we 
alpar@1620
   476
        /// iterate the edge-set, the iteration order is the same.
alpar@1620
   477
        IncEdgeIt(const UndirGraph&, const UndirEdge&) { }
alpar@1620
   478
        /// Next incident edge
alpar@1620
   479
alpar@1620
   480
        /// Assign the iterator to the next incident edge
alpar@1620
   481
	/// of the corresponding node.
alpar@1620
   482
        IncEdgeIt& operator++() { return *this; }
alpar@1620
   483
      };
alpar@1620
   484
deba@1627
   485
      /// The directed edge type.
deba@1627
   486
deba@1627
   487
      /// The directed edge type. It can be converted to the
deba@1627
   488
      /// undirected edge.
deba@1627
   489
      class Edge : public UndirEdge {
deba@1627
   490
      public:
deba@1627
   491
        /// Default constructor
deba@1627
   492
deba@1627
   493
        /// @warning The default constructor sets the iterator
deba@1627
   494
        /// to an undefined value.
deba@1627
   495
        Edge() { }
deba@1627
   496
        /// Copy constructor.
deba@1627
   497
deba@1627
   498
        /// Copy constructor.
deba@1627
   499
        ///
deba@1627
   500
        Edge(const Edge& e) : UndirEdge(e) { }
deba@1627
   501
        /// Initialize the iterator to be invalid.
deba@1627
   502
deba@1627
   503
        /// Initialize the iterator to be invalid.
deba@1627
   504
        ///
deba@1627
   505
        Edge(Invalid) { }
deba@1627
   506
        /// Equality operator
deba@1627
   507
deba@1627
   508
        /// Two iterators are equal if and only if they point to the
deba@1627
   509
        /// same object or both are invalid.
deba@1627
   510
        bool operator==(Edge) const { return true; }
deba@1627
   511
        /// Inequality operator
deba@1627
   512
deba@1627
   513
        /// \sa operator==(Edge n)
deba@1627
   514
        ///
deba@1627
   515
        bool operator!=(Edge) const { return true; }
deba@1627
   516
deba@1627
   517
	/// Artificial ordering operator.
deba@1627
   518
	
deba@1627
   519
	/// To allow the use of graph descriptors as key type in std::map or
deba@1627
   520
	/// similar associative container we require this.
deba@1627
   521
	///
deba@1627
   522
	/// \note This operator only have to define some strict ordering of
deba@1627
   523
	/// the items; this order has nothing to do with the iteration
deba@1627
   524
	/// ordering of the items.
deba@1627
   525
	///
deba@1627
   526
	/// \bug This is a technical requirement. Do we really need this?
deba@1627
   527
	bool operator<(Edge) const { return false; }
deba@1627
   528
	
deba@1627
   529
      }; 
deba@1627
   530
      /// This iterator goes through each directed edge.
deba@1627
   531
deba@1627
   532
      /// This iterator goes through each edge of a graph.
deba@1627
   533
      /// Its usage is quite simple, for example you can count the number
deba@1627
   534
      /// of edges in a graph \c g of type \c Graph as follows:
deba@1627
   535
      /// \code
deba@1627
   536
      /// int count=0;
deba@1627
   537
      /// for(Graph::EdgeIt e(g); e!=INVALID; ++e) ++count;
deba@1627
   538
      /// \endcode
deba@1627
   539
      class EdgeIt : public Edge {
deba@1627
   540
      public:
deba@1627
   541
        /// Default constructor
deba@1627
   542
deba@1627
   543
        /// @warning The default constructor sets the iterator
deba@1627
   544
        /// to an undefined value.
deba@1627
   545
        EdgeIt() { }
deba@1627
   546
        /// Copy constructor.
deba@1627
   547
deba@1627
   548
        /// Copy constructor.
deba@1627
   549
        ///
deba@1627
   550
        EdgeIt(const EdgeIt& e) : Edge(e) { }
deba@1627
   551
        /// Initialize the iterator to be invalid.
deba@1627
   552
deba@1627
   553
        /// Initialize the iterator to be invalid.
deba@1627
   554
        ///
deba@1627
   555
        EdgeIt(Invalid) { }
deba@1627
   556
        /// This constructor sets the iterator to the first edge.
deba@1627
   557
    
deba@1627
   558
        /// This constructor sets the iterator to the first edge of \c g.
deba@1627
   559
        ///@param g the graph
deba@1627
   560
        EdgeIt(const UndirGraph&) { }
deba@1627
   561
        /// Edge -> EdgeIt conversion
deba@1627
   562
deba@1627
   563
        /// Sets the iterator to the value of the trivial iterator \c e.
deba@1627
   564
        /// This feature necessitates that each time we 
deba@1627
   565
        /// iterate the edge-set, the iteration order is the same.
deba@1627
   566
        EdgeIt(const UndirGraph&, const Edge&) { } 
deba@1627
   567
        ///Next edge
deba@1627
   568
        
deba@1627
   569
        /// Assign the iterator to the next edge.
deba@1627
   570
        EdgeIt& operator++() { return *this; }
deba@1627
   571
      };
deba@1627
   572
   
deba@1627
   573
      /// This iterator goes trough the outgoing directed edges of a node.
deba@1627
   574
deba@1627
   575
      /// This iterator goes trough the \e outgoing edges of a certain node
deba@1627
   576
      /// of a graph.
deba@1627
   577
      /// Its usage is quite simple, for example you can count the number
deba@1627
   578
      /// of outgoing edges of a node \c n
deba@1627
   579
      /// in graph \c g of type \c Graph as follows.
deba@1627
   580
      /// \code
deba@1627
   581
      /// int count=0;
deba@1627
   582
      /// for (Graph::OutEdgeIt e(g, n); e!=INVALID; ++e) ++count;
deba@1627
   583
      /// \endcode
deba@1627
   584
    
deba@1627
   585
      class OutEdgeIt : public Edge {
deba@1627
   586
      public:
deba@1627
   587
        /// Default constructor
deba@1627
   588
deba@1627
   589
        /// @warning The default constructor sets the iterator
deba@1627
   590
        /// to an undefined value.
deba@1627
   591
        OutEdgeIt() { }
deba@1627
   592
        /// Copy constructor.
deba@1627
   593
deba@1627
   594
        /// Copy constructor.
deba@1627
   595
        ///
deba@1627
   596
        OutEdgeIt(const OutEdgeIt& e) : Edge(e) { }
deba@1627
   597
        /// Initialize the iterator to be invalid.
deba@1627
   598
deba@1627
   599
        /// Initialize the iterator to be invalid.
deba@1627
   600
        ///
deba@1627
   601
        OutEdgeIt(Invalid) { }
deba@1627
   602
        /// This constructor sets the iterator to the first outgoing edge.
deba@1627
   603
    
deba@1627
   604
        /// This constructor sets the iterator to the first outgoing edge of
deba@1627
   605
        /// the node.
deba@1627
   606
        ///@param n the node
deba@1627
   607
        ///@param g the graph
deba@1627
   608
        OutEdgeIt(const UndirGraph&, const Node&) { }
deba@1627
   609
        /// Edge -> OutEdgeIt conversion
deba@1627
   610
deba@1627
   611
        /// Sets the iterator to the value of the trivial iterator.
deba@1627
   612
	/// This feature necessitates that each time we 
deba@1627
   613
        /// iterate the edge-set, the iteration order is the same.
deba@1627
   614
        OutEdgeIt(const UndirGraph&, const Edge&) { }
deba@1627
   615
        ///Next outgoing edge
deba@1627
   616
        
deba@1627
   617
        /// Assign the iterator to the next 
deba@1627
   618
        /// outgoing edge of the corresponding node.
deba@1627
   619
        OutEdgeIt& operator++() { return *this; }
deba@1627
   620
      };
deba@1627
   621
deba@1627
   622
      /// This iterator goes trough the incoming directed edges of a node.
deba@1627
   623
deba@1627
   624
      /// This iterator goes trough the \e incoming edges of a certain node
deba@1627
   625
      /// of a graph.
deba@1627
   626
      /// Its usage is quite simple, for example you can count the number
deba@1627
   627
      /// of outgoing edges of a node \c n
deba@1627
   628
      /// in graph \c g of type \c Graph as follows.
deba@1627
   629
      /// \code
deba@1627
   630
      /// int count=0;
deba@1627
   631
      /// for(Graph::InEdgeIt e(g, n); e!=INVALID; ++e) ++count;
deba@1627
   632
      /// \endcode
deba@1627
   633
deba@1627
   634
      class InEdgeIt : public Edge {
deba@1627
   635
      public:
deba@1627
   636
        /// Default constructor
deba@1627
   637
deba@1627
   638
        /// @warning The default constructor sets the iterator
deba@1627
   639
        /// to an undefined value.
deba@1627
   640
        InEdgeIt() { }
deba@1627
   641
        /// Copy constructor.
deba@1627
   642
deba@1627
   643
        /// Copy constructor.
deba@1627
   644
        ///
deba@1627
   645
        InEdgeIt(const InEdgeIt& e) : Edge(e) { }
deba@1627
   646
        /// Initialize the iterator to be invalid.
deba@1627
   647
deba@1627
   648
        /// Initialize the iterator to be invalid.
deba@1627
   649
        ///
deba@1627
   650
        InEdgeIt(Invalid) { }
deba@1627
   651
        /// This constructor sets the iterator to first incoming edge.
deba@1627
   652
    
deba@1627
   653
        /// This constructor set the iterator to the first incoming edge of
deba@1627
   654
        /// the node.
deba@1627
   655
        ///@param n the node
deba@1627
   656
        ///@param g the graph
deba@1627
   657
        InEdgeIt(const UndirGraph&, const Node&) { }
deba@1627
   658
        /// Edge -> InEdgeIt conversion
deba@1627
   659
deba@1627
   660
        /// Sets the iterator to the value of the trivial iterator \c e.
deba@1627
   661
        /// This feature necessitates that each time we 
deba@1627
   662
        /// iterate the edge-set, the iteration order is the same.
deba@1627
   663
        InEdgeIt(const UndirGraph&, const Edge&) { }
deba@1627
   664
        /// Next incoming edge
deba@1627
   665
deba@1627
   666
        /// Assign the iterator to the next inedge of the corresponding node.
deba@1627
   667
        ///
deba@1627
   668
        InEdgeIt& operator++() { return *this; }
deba@1627
   669
      };
deba@1627
   670
deba@1627
   671
      /// \brief Read write map of the nodes to type \c T.
deba@1627
   672
      /// 
deba@1627
   673
      /// ReadWrite map of the nodes to type \c T.
deba@1627
   674
      /// \sa Reference
deba@1627
   675
      /// \warning Making maps that can handle bool type (NodeMap<bool>)
deba@1627
   676
      /// needs some extra attention!
deba@1627
   677
      template<class T> 
deba@1627
   678
      class NodeMap : public ReadWriteMap< Node, T >
deba@1627
   679
      {
deba@1627
   680
      public:
deba@1627
   681
deba@1627
   682
        ///\e
deba@1627
   683
        NodeMap(const UndirGraph&) { }
deba@1627
   684
        ///\e
deba@1627
   685
        NodeMap(const UndirGraph&, T) { }
deba@1627
   686
deba@1627
   687
        ///Copy constructor
deba@1627
   688
        NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
deba@1627
   689
        ///Assignment operator
deba@1627
   690
        NodeMap& operator=(const NodeMap&) { return *this; }
deba@1627
   691
        // \todo fix this concept
deba@1627
   692
      };
deba@1627
   693
deba@1627
   694
      /// \brief Read write map of the directed edges to type \c T.
deba@1627
   695
      ///
deba@1627
   696
      /// Reference map of the directed edges to type \c T.
deba@1627
   697
      /// \sa Reference
deba@1627
   698
      /// \warning Making maps that can handle bool type (EdgeMap<bool>)
deba@1627
   699
      /// needs some extra attention!
deba@1627
   700
      template<class T> 
deba@1627
   701
      class EdgeMap : public ReadWriteMap<Edge,T>
deba@1627
   702
      {
deba@1627
   703
      public:
deba@1627
   704
deba@1627
   705
        ///\e
deba@1627
   706
        EdgeMap(const UndirGraph&) { }
deba@1627
   707
        ///\e
deba@1627
   708
        EdgeMap(const UndirGraph&, T) { }
deba@1627
   709
        ///Copy constructor
deba@1627
   710
        EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) { }
deba@1627
   711
        ///Assignment operator
deba@1627
   712
        EdgeMap& operator=(const EdgeMap&) { return *this; }
deba@1627
   713
        // \todo fix this concept    
deba@1627
   714
      };
deba@1627
   715
alpar@1620
   716
      /// Read write map of the undirected edges to type \c T.
alpar@1620
   717
alpar@1620
   718
      /// Reference map of the edges to type \c T.
alpar@1620
   719
      /// \sa Reference
alpar@1620
   720
      /// \warning Making maps that can handle bool type (UndirEdgeMap<bool>)
alpar@1620
   721
      /// needs some extra attention!
alpar@1620
   722
      template<class T> 
alpar@1620
   723
      class UndirEdgeMap : public ReadWriteMap<UndirEdge,T>
alpar@1620
   724
      {
klao@1030
   725
      public:
klao@1030
   726
alpar@1620
   727
        ///\e
alpar@1620
   728
        UndirEdgeMap(const UndirGraph&) { }
alpar@1620
   729
        ///\e
alpar@1620
   730
        UndirEdgeMap(const UndirGraph&, T) { }
alpar@1620
   731
        ///Copy constructor
deba@1627
   732
        UndirEdgeMap(const UndirEdgeMap& em) : ReadWriteMap<UndirEdge,T>(em) {}
alpar@1620
   733
        ///Assignment operator
alpar@1620
   734
        UndirEdgeMap &operator=(const UndirEdgeMap&) { return *this; }
alpar@1620
   735
        // \todo fix this concept    
klao@1030
   736
      };
klao@1030
   737
deba@1627
   738
      /// \brief Direct the given undirected edge.
deba@1627
   739
      ///
deba@1627
   740
      /// Direct the given undirected edge. The returned edge source
deba@1627
   741
      /// will be the given edge.
deba@1627
   742
      Edge direct(const UndirEdge&, const Node&) const {
deba@1627
   743
	return INVALID;
deba@1627
   744
      }
klao@1030
   745
deba@1627
   746
      /// \brief Direct the given undirected edge.
deba@1627
   747
      ///
deba@1627
   748
      /// Direct the given undirected edge. The returned edge source
deba@1627
   749
      /// will be the source of the undirected edge if the given bool
deba@1627
   750
      /// is true.
deba@1627
   751
      Edge direct(const UndirEdge&, bool) const {
deba@1627
   752
	return INVALID;
deba@1627
   753
      }
deba@1627
   754
deba@1627
   755
      /// \brief Returns true if the edge has default orientation.
deba@1627
   756
      ///
klao@1030
   757
      /// Returns whether the given directed edge is same orientation as
klao@1030
   758
      /// the corresponding undirected edge.
deba@1627
   759
      bool direction(Edge) const { return true; }
deba@1627
   760
deba@1627
   761
      /// \brief Returns the opposite directed edge.
klao@1030
   762
      ///
deba@1627
   763
      /// Returns the opposite directed edge.
deba@1627
   764
      Edge oppositeEdge(Edge) const { return INVALID; }
klao@1030
   765
deba@1627
   766
      /// \brief Opposite node on an edge
deba@1627
   767
      ///
klao@1030
   768
      /// \return the opposite of the given Node on the given Edge
klao@1030
   769
      Node oppositeNode(Node, UndirEdge) const { return INVALID; }
klao@1030
   770
deba@1627
   771
      /// \brief First node of the undirected edge.
deba@1627
   772
      ///
klao@1030
   773
      /// \return the first node of the given UndirEdge.
klao@1030
   774
      ///
klao@1030
   775
      /// Naturally undirectected edges don't have direction and thus
klao@1030
   776
      /// don't have source and target node. But we use these two methods
klao@1030
   777
      /// to query the two endnodes of the edge. The direction of the edge
klao@1030
   778
      /// which arises this way is called the inherent direction of the
deba@1627
   779
      /// undirected edge, and is used to define the "default" direction
klao@1030
   780
      /// of the directed versions of the edges.
deba@1627
   781
      /// \sa direction
klao@1030
   782
      Node source(UndirEdge) const { return INVALID; }
klao@1030
   783
deba@1627
   784
      /// \brief Second node of the undirected edge.
klao@1030
   785
      Node target(UndirEdge) const { return INVALID; }
klao@1030
   786
deba@1627
   787
      /// \brief Source node of the directed edge.
klao@1030
   788
      Node source(Edge) const { return INVALID; }
klao@1030
   789
deba@1627
   790
      /// \brief Target node of the directed edge.
klao@1030
   791
      Node target(Edge) const { return INVALID; }
klao@1030
   792
deba@1627
   793
      /// \brief First node of the graph
deba@1627
   794
      ///
klao@1030
   795
      /// \note This method is part of so called \ref
klao@1030
   796
      /// developpers_interface "Developpers' interface", so it shouldn't
klao@1030
   797
      /// be used in an end-user program.
klao@1030
   798
      void first(Node&) const {}
deba@1627
   799
      /// \brief Next node of the graph
deba@1627
   800
      ///
klao@1030
   801
      /// \note This method is part of so called \ref
klao@1030
   802
      /// developpers_interface "Developpers' interface", so it shouldn't
klao@1030
   803
      /// be used in an end-user program.
klao@1030
   804
      void next(Node&) const {}
klao@1030
   805
deba@1627
   806
      /// \brief First undirected edge of the graph
deba@1627
   807
      ///
klao@1030
   808
      /// \note This method is part of so called \ref
klao@1030
   809
      /// developpers_interface "Developpers' interface", so it shouldn't
klao@1030
   810
      /// be used in an end-user program.
klao@1030
   811
      void first(UndirEdge&) const {}
deba@1627
   812
      /// \brief Next undirected edge of the graph
deba@1627
   813
      ///
klao@1030
   814
      /// \note This method is part of so called \ref
klao@1030
   815
      /// developpers_interface "Developpers' interface", so it shouldn't
klao@1030
   816
      /// be used in an end-user program.
klao@1030
   817
      void next(UndirEdge&) const {}
klao@1030
   818
deba@1627
   819
      /// \brief First directed edge of the graph
deba@1627
   820
      ///
klao@1030
   821
      /// \note This method is part of so called \ref
klao@1030
   822
      /// developpers_interface "Developpers' interface", so it shouldn't
klao@1030
   823
      /// be used in an end-user program.
klao@1030
   824
      void first(Edge&) const {}
deba@1627
   825
      /// \brief Next directed edge of the graph
deba@1627
   826
      ///
klao@1030
   827
      /// \note This method is part of so called \ref
klao@1030
   828
      /// developpers_interface "Developpers' interface", so it shouldn't
klao@1030
   829
      /// be used in an end-user program.
klao@1030
   830
      void next(Edge&) const {}
klao@1030
   831
deba@1627
   832
      /// \brief First outgoing edge from a given node
deba@1627
   833
      ///
klao@1030
   834
      /// \note This method is part of so called \ref
klao@1030
   835
      /// developpers_interface "Developpers' interface", so it shouldn't
klao@1030
   836
      /// be used in an end-user program.
klao@1030
   837
      void firstOut(Edge&, Node) const {}
deba@1627
   838
      /// \brief Next outgoing edge to a node
deba@1627
   839
      ///
klao@1030
   840
      /// \note This method is part of so called \ref
klao@1030
   841
      /// developpers_interface "Developpers' interface", so it shouldn't
klao@1030
   842
      /// be used in an end-user program.
klao@1030
   843
      void nextOut(Edge&) const {}
klao@1030
   844
deba@1627
   845
      /// \brief First incoming edge to a given node
deba@1627
   846
      ///
klao@1030
   847
      /// \note This method is part of so called \ref
klao@1030
   848
      /// developpers_interface "Developpers' interface", so it shouldn't
klao@1030
   849
      /// be used in an end-user program.
klao@1030
   850
      void firstIn(Edge&, Node) const {}
deba@1627
   851
      /// \brief Next incoming edge to a node
deba@1627
   852
      ///
klao@1030
   853
      /// \note This method is part of so called \ref
klao@1030
   854
      /// developpers_interface "Developpers' interface", so it shouldn't
klao@1030
   855
      /// be used in an end-user program.
klao@1030
   856
      void nextIn(Edge&) const {}
klao@1030
   857
klao@1030
   858
deba@1627
   859
      /// \brief Base node of the iterator
klao@1158
   860
      ///
klao@1158
   861
      /// Returns the base node (the source in this case) of the iterator
klao@1158
   862
      Node baseNode(OutEdgeIt e) const {
klao@1158
   863
	return source(e);
klao@1158
   864
      }
deba@1627
   865
      /// \brief Running node of the iterator
klao@1158
   866
      ///
klao@1158
   867
      /// Returns the running node (the target in this case) of the
klao@1158
   868
      /// iterator
klao@1158
   869
      Node runningNode(OutEdgeIt e) const {
klao@1158
   870
	return target(e);
klao@1158
   871
      }
klao@1158
   872
deba@1627
   873
      /// \brief Base node of the iterator
klao@1158
   874
      ///
klao@1158
   875
      /// Returns the base node (the target in this case) of the iterator
klao@1158
   876
      Node baseNode(InEdgeIt e) const {
klao@1158
   877
	return target(e);
klao@1158
   878
      }
deba@1627
   879
      /// \brief Running node of the iterator
klao@1158
   880
      ///
klao@1158
   881
      /// Returns the running node (the source in this case) of the
klao@1158
   882
      /// iterator
klao@1158
   883
      Node runningNode(InEdgeIt e) const {
klao@1158
   884
	return source(e);
klao@1158
   885
      }
klao@1158
   886
deba@1627
   887
      /// \brief Base node of the iterator
klao@1158
   888
      ///
klao@1158
   889
      /// Returns the base node of the iterator
alpar@1367
   890
      Node baseNode(IncEdgeIt) const {
klao@1158
   891
	return INVALID;
klao@1158
   892
      }
deba@1627
   893
      
deba@1627
   894
      /// \brief Running node of the iterator
klao@1158
   895
      ///
klao@1158
   896
      /// Returns the running node of the iterator
alpar@1367
   897
      Node runningNode(IncEdgeIt) const {
klao@1158
   898
	return INVALID;
klao@1158
   899
      }
klao@1158
   900
klao@1022
   901
      template <typename Graph>
klao@1022
   902
      struct Constraints {
klao@1022
   903
	void constraints() {
klao@1022
   904
	  checkConcept<BaseIterableUndirGraphConcept, Graph>();
klao@1022
   905
	  checkConcept<IterableUndirGraphConcept, Graph>();
klao@1022
   906
	  checkConcept<MappableUndirGraphConcept, Graph>();
klao@1022
   907
	}
klao@1022
   908
      };
klao@1022
   909
klao@1022
   910
    };
klao@1022
   911
deba@1627
   912
    /// \brief An empty non-static undirected graph class.
deba@1627
   913
    ///    
deba@1627
   914
    /// This class provides everything that \ref UndirGraph does.
deba@1627
   915
    /// Additionally it enables building graphs from scratch.
klao@1022
   916
    class ExtendableUndirGraph : public UndirGraph {
klao@1022
   917
    public:
deba@1627
   918
      
deba@1627
   919
      /// \brief Add a new node to the graph.
deba@1627
   920
      ///
deba@1627
   921
      /// Add a new node to the graph.
deba@1627
   922
      /// \return the new node.
deba@1627
   923
      Node addNode();
deba@1627
   924
deba@1627
   925
      /// \brief Add a new undirected edge to the graph.
deba@1627
   926
      ///
deba@1627
   927
      /// Add a new undirected edge to the graph.
deba@1627
   928
      /// \return the new edge.
deba@1627
   929
      UndirEdge addEdge(const Node& from, const Node& to);
deba@1627
   930
deba@1627
   931
      /// \brief Resets the graph.
deba@1627
   932
      ///
deba@1627
   933
      /// This function deletes all undirected edges and nodes of the graph.
deba@1627
   934
      /// It also frees the memory allocated to store them.
deba@1627
   935
      void clear() { }
klao@1022
   936
klao@1022
   937
      template <typename Graph>
klao@1022
   938
      struct Constraints {
klao@1022
   939
	void constraints() {
klao@1022
   940
	  checkConcept<BaseIterableUndirGraphConcept, Graph>();
klao@1022
   941
	  checkConcept<IterableUndirGraphConcept, Graph>();
klao@1022
   942
	  checkConcept<MappableUndirGraphConcept, Graph>();
klao@1022
   943
klao@1022
   944
	  checkConcept<UndirGraph, Graph>();
klao@1022
   945
	  checkConcept<ExtendableUndirGraphConcept, Graph>();
klao@1022
   946
	  checkConcept<ClearableGraphComponent, Graph>();
klao@1022
   947
	}
klao@1022
   948
      };
klao@1022
   949
klao@1022
   950
    };
klao@1022
   951
deba@1627
   952
    /// \brief An empty erasable undirected graph class.
deba@1627
   953
    ///
deba@1627
   954
    /// This class is an extension of \ref ExtendableUndirGraph. It makes it
deba@1627
   955
    /// possible to erase undirected edges or nodes.
klao@1022
   956
    class ErasableUndirGraph : public ExtendableUndirGraph {
klao@1022
   957
    public:
klao@1022
   958
deba@1627
   959
      /// \brief Deletes a node.
deba@1627
   960
      ///
deba@1627
   961
      /// Deletes a node.
deba@1627
   962
      ///
deba@1627
   963
      void erase(Node) { }
deba@1627
   964
      /// \brief Deletes an undirected edge.
deba@1627
   965
      ///
deba@1627
   966
      /// Deletes an undirected edge.
deba@1627
   967
      ///
deba@1627
   968
      void erase(UndirEdge) { }
deba@1627
   969
klao@1022
   970
      template <typename Graph>
klao@1022
   971
      struct Constraints {
klao@1022
   972
	void constraints() {
klao@1022
   973
	  checkConcept<ExtendableUndirGraph, Graph>();
klao@1022
   974
	  checkConcept<ErasableUndirGraphConcept, Graph>();
klao@1022
   975
	}
klao@1022
   976
      };
klao@1022
   977
klao@962
   978
    };
klao@962
   979
klao@1030
   980
    /// @}
klao@1030
   981
klao@962
   982
  }
klao@962
   983
klao@962
   984
}
klao@962
   985
klao@962
   986
#endif