lemon/concept/undir_graph.h
author deba
Thu, 11 Aug 2005 13:16:39 +0000
changeset 1622 9c98841eda96
parent 1448 0274acee0e35
child 1624 61cc647dac99
permissions -rw-r--r--
Ordering in the graph concept.
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;
klao@1030
   122
	  b = graph.forward(e);
klao@1030
   123
	  ignore_unused_variable_warning(b);
klao@1022
   124
	}
klao@1030
   125
klao@1030
   126
	Graph graph;
klao@1022
   127
	Edge e;
klao@1030
   128
	Node n0;
klao@1030
   129
	UndirEdge ue;
klao@1022
   130
      };
klao@1022
   131
klao@962
   132
    };
klao@962
   133
klao@1022
   134
klao@962
   135
    struct IterableUndirGraphConcept {
klao@962
   136
klao@1022
   137
      template <typename Graph>
klao@1022
   138
      struct Constraints {
klao@1022
   139
	void constraints() {
klao@1022
   140
	  /// \todo we don't need the iterable component to be base iterable
klao@1022
   141
	  /// Don't we really???
klao@1022
   142
	  //checkConcept< BaseIterableUndirGraphConcept, Graph > ();
klao@962
   143
klao@1022
   144
	  checkConcept<IterableGraphComponent, Graph> ();
klao@1021
   145
klao@1022
   146
	  typedef typename Graph::UndirEdge UndirEdge;
klao@1022
   147
	  typedef typename Graph::UndirEdgeIt UndirEdgeIt;
klao@1030
   148
	  typedef typename Graph::IncEdgeIt IncEdgeIt;
klao@1022
   149
klao@1022
   150
	  checkConcept<GraphIterator<Graph, UndirEdge>, UndirEdgeIt>();
klao@1030
   151
	  checkConcept<GraphIncIterator<Graph, UndirEdge>, IncEdgeIt>();
klao@1022
   152
	}
klao@1022
   153
      };
klao@1022
   154
klao@1022
   155
    };
klao@1022
   156
klao@1022
   157
    struct MappableUndirGraphConcept {
klao@1022
   158
klao@1022
   159
      template <typename Graph>
klao@1022
   160
      struct Constraints {
klao@1022
   161
klao@1022
   162
	struct Dummy {
klao@1022
   163
	  int value;
klao@1022
   164
	  Dummy() : value(0) {}
klao@1022
   165
	  Dummy(int _v) : value(_v) {}
klao@1022
   166
	};
klao@1022
   167
klao@1022
   168
	void constraints() {
klao@1022
   169
	  checkConcept<MappableGraphComponent, Graph>();
klao@1022
   170
klao@1022
   171
	  typedef typename Graph::template UndirEdgeMap<int> IntMap;
klao@1022
   172
	  checkConcept<GraphMap<Graph, typename Graph::UndirEdge, int>,
klao@1022
   173
	    IntMap >();
klao@1022
   174
klao@1022
   175
	  typedef typename Graph::template UndirEdgeMap<bool> BoolMap;
klao@1022
   176
	  checkConcept<GraphMap<Graph, typename Graph::UndirEdge, bool>,
klao@1022
   177
	    BoolMap >();
klao@1022
   178
klao@1022
   179
	  typedef typename Graph::template UndirEdgeMap<Dummy> DummyMap;
klao@1022
   180
	  checkConcept<GraphMap<Graph, typename Graph::UndirEdge, Dummy>,
klao@1022
   181
	    DummyMap >();
klao@1022
   182
	}
klao@1022
   183
      };
klao@1022
   184
klao@1022
   185
    };
klao@1022
   186
klao@1022
   187
    struct ExtendableUndirGraphConcept {
klao@1022
   188
klao@1022
   189
      template <typename Graph>
klao@1022
   190
      struct Constraints {
klao@1022
   191
	void constraints() {
klao@1022
   192
	  node_a = graph.addNode();
klao@1022
   193
	  uedge = graph.addEdge(node_a, node_b);
klao@1022
   194
	}
klao@1022
   195
	typename Graph::Node node_a, node_b;
klao@1022
   196
	typename Graph::UndirEdge uedge;
klao@1022
   197
	Graph graph;
klao@1022
   198
      };
klao@1022
   199
klao@1022
   200
    };
klao@1022
   201
klao@1022
   202
    struct ErasableUndirGraphConcept {
klao@1022
   203
klao@1022
   204
      template <typename Graph>
klao@1022
   205
      struct Constraints {
klao@1022
   206
	void constraints() {
klao@1022
   207
	  graph.erase(n);
klao@1022
   208
	  graph.erase(e);
klao@1022
   209
	}
klao@1022
   210
	Graph graph;
klao@1022
   211
	typename Graph::Node n;
klao@1022
   212
	typename Graph::UndirEdge e;
klao@1022
   213
      };
klao@1022
   214
klao@1022
   215
    };
klao@1022
   216
alpar@1620
   217
    /// \addtogroup graph_concepts
alpar@1620
   218
    /// @{
alpar@1620
   219
alpar@1620
   220
klao@1030
   221
    /// Class describing the concept of Undirected Graphs.
klao@1030
   222
klao@1030
   223
    /// This class describes the common interface of all Undirected
klao@1030
   224
    /// Graphs.
klao@1030
   225
    ///
klao@1030
   226
    /// As all concept describing classes it provides only interface
klao@1030
   227
    /// without any sensible implementation. So any algorithm for
klao@1030
   228
    /// undirected graph should compile with this class, but it will not
klao@1030
   229
    /// run properly, of couse.
klao@1030
   230
    ///
klao@1030
   231
    /// In LEMON undirected graphs also fulfill the concept of directed
klao@1030
   232
    /// graphs (\ref lemon::concept::Graph "Graph Concept"). For
klao@1030
   233
    /// explanation of this and more see also the page \ref undir_graphs,
klao@1030
   234
    /// a tutorial about undirected graphs.
klao@1030
   235
alpar@1620
   236
    class UndirGraph : public StaticGraph {
klao@1022
   237
    public:
alpar@1448
   238
      ///\e
alpar@1448
   239
alpar@1448
   240
      ///\todo undocumented
alpar@1448
   241
      ///
alpar@1448
   242
      typedef True UndirTag;
klao@1022
   243
alpar@1620
   244
      /// The base type of the undirected edge iterators.
alpar@1620
   245
      
alpar@1620
   246
      /// The base type of the undirected edge iterators.
alpar@1620
   247
      ///
alpar@1620
   248
      class UndirEdge {
alpar@1620
   249
      public:
alpar@1620
   250
        /// Default constructor
klao@1030
   251
alpar@1620
   252
        /// @warning The default constructor sets the iterator
alpar@1620
   253
        /// to an undefined value.
alpar@1620
   254
        UndirEdge() { }
alpar@1620
   255
        /// Copy constructor.
klao@1030
   256
alpar@1620
   257
        /// Copy constructor.
alpar@1620
   258
        ///
alpar@1620
   259
        UndirEdge(const UndirEdge&) { }
alpar@1620
   260
        /// Edge -> UndirEdge conversion
klao@1030
   261
alpar@1620
   262
        /// Edge -> UndirEdge conversion
alpar@1620
   263
        ///
alpar@1620
   264
        UndirEdge(const Edge&) { }
alpar@1620
   265
        /// Initialize the iterator to be invalid.
klao@1030
   266
alpar@1620
   267
        /// Initialize the iterator to be invalid.
alpar@1620
   268
        ///
alpar@1620
   269
        UndirEdge(Invalid) { }
alpar@1620
   270
        /// Equality operator
klao@1030
   271
alpar@1620
   272
        /// Two iterators are equal if and only if they point to the
alpar@1620
   273
        /// same object or both are invalid.
alpar@1620
   274
        bool operator==(UndirEdge) const { return true; }
alpar@1620
   275
        /// Inequality operator
klao@1030
   276
alpar@1620
   277
        /// \sa operator==(UndirEdge n)
alpar@1620
   278
        ///
alpar@1620
   279
        bool operator!=(UndirEdge) const { return true; }
klao@1030
   280
alpar@1620
   281
	///\e
klao@1030
   282
alpar@1620
   283
	///\todo Do we need this?
alpar@1620
   284
	///
alpar@1620
   285
	bool operator<(const UndirEdge &that) const { return true; }
alpar@1620
   286
      };
alpar@1620
   287
    
alpar@1620
   288
      /// This iterator goes through each undirected edge.
klao@1030
   289
alpar@1620
   290
      /// This iterator goes through each undirected edge of a graph.
alpar@1620
   291
      /// Its usage is quite simple, for example you can count the number
alpar@1620
   292
      /// of edges in a graph \c g of type \c Graph as follows:
alpar@1620
   293
      /// \code
alpar@1620
   294
      /// int count=0;
alpar@1620
   295
      /// for(Graph::UndirEdgeIt e(g); e!=INVALID; ++e) ++count;
alpar@1620
   296
      /// \endcode
alpar@1620
   297
      class UndirEdgeIt : public UndirEdge {
alpar@1620
   298
      public:
alpar@1620
   299
        /// Default constructor
alpar@1620
   300
	
alpar@1620
   301
        /// @warning The default constructor sets the iterator
alpar@1620
   302
        /// to an undefined value.
alpar@1620
   303
        UndirEdgeIt() { }
alpar@1620
   304
        /// Copy constructor.
alpar@1620
   305
	
alpar@1620
   306
        /// Copy constructor.
alpar@1620
   307
        ///
alpar@1620
   308
        UndirEdgeIt(const UndirEdgeIt& e) : UndirEdge(e) { }
alpar@1620
   309
        /// Initialize the iterator to be invalid.
klao@1030
   310
alpar@1620
   311
        /// Initialize the iterator to be invalid.
alpar@1620
   312
        ///
alpar@1620
   313
        UndirEdgeIt(Invalid) { }
alpar@1620
   314
        /// This constructor sets the iterator to the first edge.
alpar@1620
   315
    
alpar@1620
   316
        /// This constructor sets the iterator to the first edge of \c g.
alpar@1620
   317
        ///@param g the graph
alpar@1620
   318
        UndirEdgeIt(const UndirGraph&) { }
alpar@1620
   319
        /// UndirEdge -> UndirEdgeIt conversion
klao@1030
   320
alpar@1620
   321
        /// Sets the iterator to the value of the trivial iterator \c e.
alpar@1620
   322
        /// This feature necessitates that each time we 
alpar@1620
   323
        /// iterate the edge-set, the iteration order is the same.
alpar@1620
   324
        UndirEdgeIt(const UndirGraph&, const UndirEdge&) { } 
alpar@1620
   325
        ///Next edge
alpar@1620
   326
        
alpar@1620
   327
        /// Assign the iterator to the next edge.
alpar@1620
   328
        UndirEdgeIt& operator++() { return *this; }
alpar@1620
   329
      };
klao@1030
   330
alpar@1620
   331
      /// This iterator goes trough the incident undirected edges of a node.
klao@1030
   332
alpar@1620
   333
      /// This iterator goes trough the incident undirected edges
alpar@1620
   334
      /// of a certain node
alpar@1620
   335
      /// of a graph.
alpar@1620
   336
      /// Its usage is quite simple, for example you can compute the
alpar@1620
   337
      /// degree (i.e. count the number
alpar@1620
   338
      /// of incident edges of a node \c n
alpar@1620
   339
      /// in graph \c g of type \c Graph as follows.
alpar@1620
   340
      /// \code
alpar@1620
   341
      /// int count=0;
alpar@1620
   342
      /// for(Graph::IncEdgeIt e(g, n); e!=INVALID; ++e) ++count;
alpar@1620
   343
      /// \endcode
alpar@1620
   344
      class IncEdgeIt : public UndirEdge {
alpar@1620
   345
      public:
alpar@1620
   346
        /// Default constructor
klao@1030
   347
alpar@1620
   348
        /// @warning The default constructor sets the iterator
alpar@1620
   349
        /// to an undefined value.
alpar@1620
   350
        IncEdgeIt() { }
alpar@1620
   351
        /// Copy constructor.
alpar@1620
   352
alpar@1620
   353
        /// Copy constructor.
alpar@1620
   354
        ///
alpar@1620
   355
        IncEdgeIt(const IncEdgeIt& e) : UndirEdge(e) { }
alpar@1620
   356
        /// Initialize the iterator to be invalid.
alpar@1620
   357
alpar@1620
   358
        /// Initialize the iterator to be invalid.
alpar@1620
   359
        ///
alpar@1620
   360
        IncEdgeIt(Invalid) { }
alpar@1620
   361
        /// This constructor sets the iterator to first incident edge.
alpar@1620
   362
    
alpar@1620
   363
        /// This constructor set the iterator to the first incident edge of
alpar@1620
   364
        /// the node.
alpar@1620
   365
        ///@param n the node
alpar@1620
   366
        ///@param g the graph
alpar@1620
   367
        IncEdgeIt(const UndirGraph&, const Node&) { }
alpar@1620
   368
        /// UndirEdge -> IncEdgeIt conversion
alpar@1620
   369
alpar@1620
   370
        /// Sets the iterator to the value of the trivial iterator \c e.
alpar@1620
   371
        /// This feature necessitates that each time we 
alpar@1620
   372
        /// iterate the edge-set, the iteration order is the same.
alpar@1620
   373
        IncEdgeIt(const UndirGraph&, const UndirEdge&) { }
alpar@1620
   374
        /// Next incident edge
alpar@1620
   375
alpar@1620
   376
        /// Assign the iterator to the next incident edge
alpar@1620
   377
	/// of the corresponding node.
alpar@1620
   378
        IncEdgeIt& operator++() { return *this; }
alpar@1620
   379
      };
alpar@1620
   380
alpar@1620
   381
      /// Read write map of the undirected edges to type \c T.
alpar@1620
   382
alpar@1620
   383
      /// Reference map of the edges to type \c T.
alpar@1620
   384
      /// \sa Reference
alpar@1620
   385
      /// \warning Making maps that can handle bool type (UndirEdgeMap<bool>)
alpar@1620
   386
      /// needs some extra attention!
alpar@1620
   387
      template<class T> 
alpar@1620
   388
      class UndirEdgeMap : public ReadWriteMap<UndirEdge,T>
alpar@1620
   389
      {
klao@1030
   390
      public:
klao@1030
   391
alpar@1620
   392
        ///\e
alpar@1620
   393
        UndirEdgeMap(const UndirGraph&) { }
alpar@1620
   394
        ///\e
alpar@1620
   395
        UndirEdgeMap(const UndirGraph&, T) { }
alpar@1620
   396
        ///Copy constructor
alpar@1620
   397
        UndirEdgeMap(const UndirEdgeMap& em) : ReadWriteMap<UndirEdge,T>(em) { }
alpar@1620
   398
        ///Assignment operator
alpar@1620
   399
        UndirEdgeMap &operator=(const UndirEdgeMap&) { return *this; }
alpar@1620
   400
        // \todo fix this concept    
klao@1030
   401
      };
klao@1030
   402
klao@1030
   403
      /// Is the Edge oriented "forward"?
klao@1030
   404
klao@1030
   405
      /// Returns whether the given directed edge is same orientation as
klao@1030
   406
      /// the corresponding undirected edge.
klao@1030
   407
      ///
klao@1030
   408
      /// \todo "What does the direction of an undirected edge mean?"
klao@1030
   409
      bool forward(Edge) const { return true; }
klao@1030
   410
klao@1030
   411
      /// Opposite node on an edge
klao@1030
   412
klao@1030
   413
      /// \return the opposite of the given Node on the given Edge
klao@1030
   414
      ///
klao@1030
   415
      /// \todo What should we do if given Node and Edge are not incident?
klao@1030
   416
      Node oppositeNode(Node, UndirEdge) const { return INVALID; }
klao@1030
   417
klao@1030
   418
      /// First node of the undirected edge.
klao@1030
   419
klao@1030
   420
      /// \return the first node of the given UndirEdge.
klao@1030
   421
      ///
klao@1030
   422
      /// Naturally undirectected edges don't have direction and thus
klao@1030
   423
      /// don't have source and target node. But we use these two methods
klao@1030
   424
      /// to query the two endnodes of the edge. The direction of the edge
klao@1030
   425
      /// which arises this way is called the inherent direction of the
klao@1030
   426
      /// undirected edge, and is used to define the "forward" direction
klao@1030
   427
      /// of the directed versions of the edges.
klao@1030
   428
      /// \sa forward
klao@1030
   429
      Node source(UndirEdge) const { return INVALID; }
klao@1030
   430
klao@1030
   431
      /// Second node of the undirected edge.
klao@1030
   432
      Node target(UndirEdge) const { return INVALID; }
klao@1030
   433
klao@1030
   434
      /// Source node of the directed edge.
klao@1030
   435
      Node source(Edge) const { return INVALID; }
klao@1030
   436
klao@1030
   437
      /// Target node of the directed edge.
klao@1030
   438
      Node target(Edge) const { return INVALID; }
klao@1030
   439
klao@1030
   440
      /// First node of the graph
klao@1030
   441
klao@1030
   442
      /// \note This method is part of so called \ref
klao@1030
   443
      /// developpers_interface "Developpers' interface", so it shouldn't
klao@1030
   444
      /// be used in an end-user program.
klao@1030
   445
      void first(Node&) const {}
klao@1030
   446
      /// Next node of the graph
klao@1030
   447
klao@1030
   448
      /// \note This method is part of so called \ref
klao@1030
   449
      /// developpers_interface "Developpers' interface", so it shouldn't
klao@1030
   450
      /// be used in an end-user program.
klao@1030
   451
      void next(Node&) const {}
klao@1030
   452
klao@1030
   453
      /// First undirected edge of the graph
klao@1030
   454
klao@1030
   455
      /// \note This method is part of so called \ref
klao@1030
   456
      /// developpers_interface "Developpers' interface", so it shouldn't
klao@1030
   457
      /// be used in an end-user program.
klao@1030
   458
      void first(UndirEdge&) const {}
klao@1030
   459
      /// Next undirected edge of the graph
klao@1030
   460
klao@1030
   461
      /// \note This method is part of so called \ref
klao@1030
   462
      /// developpers_interface "Developpers' interface", so it shouldn't
klao@1030
   463
      /// be used in an end-user program.
klao@1030
   464
      void next(UndirEdge&) const {}
klao@1030
   465
klao@1030
   466
      /// First directed edge of the graph
klao@1030
   467
klao@1030
   468
      /// \note This method is part of so called \ref
klao@1030
   469
      /// developpers_interface "Developpers' interface", so it shouldn't
klao@1030
   470
      /// be used in an end-user program.
klao@1030
   471
      void first(Edge&) const {}
klao@1030
   472
      /// Next directed edge of the graph
klao@1030
   473
klao@1030
   474
      /// \note This method is part of so called \ref
klao@1030
   475
      /// developpers_interface "Developpers' interface", so it shouldn't
klao@1030
   476
      /// be used in an end-user program.
klao@1030
   477
      void next(Edge&) const {}
klao@1030
   478
klao@1030
   479
      /// First outgoing edge from a given node
klao@1030
   480
klao@1030
   481
      /// \note This method is part of so called \ref
klao@1030
   482
      /// developpers_interface "Developpers' interface", so it shouldn't
klao@1030
   483
      /// be used in an end-user program.
klao@1030
   484
      void firstOut(Edge&, Node) const {}
klao@1030
   485
      /// Next outgoing edge to a node
klao@1030
   486
klao@1030
   487
      /// \note This method is part of so called \ref
klao@1030
   488
      /// developpers_interface "Developpers' interface", so it shouldn't
klao@1030
   489
      /// be used in an end-user program.
klao@1030
   490
      void nextOut(Edge&) const {}
klao@1030
   491
klao@1030
   492
      /// First incoming edge to a given node
klao@1030
   493
klao@1030
   494
      /// \note This method is part of so called \ref
klao@1030
   495
      /// developpers_interface "Developpers' interface", so it shouldn't
klao@1030
   496
      /// be used in an end-user program.
klao@1030
   497
      void firstIn(Edge&, Node) const {}
klao@1030
   498
      /// Next incoming edge to a node
klao@1030
   499
klao@1030
   500
      /// \note This method is part of so called \ref
klao@1030
   501
      /// developpers_interface "Developpers' interface", so it shouldn't
klao@1030
   502
      /// be used in an end-user program.
klao@1030
   503
      void nextIn(Edge&) const {}
klao@1030
   504
klao@1030
   505
klao@1158
   506
      /// Base node of the iterator
klao@1158
   507
      ///
klao@1158
   508
      /// Returns the base node (the source in this case) of the iterator
klao@1158
   509
      Node baseNode(OutEdgeIt e) const {
klao@1158
   510
	return source(e);
klao@1158
   511
      }
klao@1158
   512
      /// Running node of the iterator
klao@1158
   513
      ///
klao@1158
   514
      /// Returns the running node (the target in this case) of the
klao@1158
   515
      /// iterator
klao@1158
   516
      Node runningNode(OutEdgeIt e) const {
klao@1158
   517
	return target(e);
klao@1158
   518
      }
klao@1158
   519
klao@1158
   520
      /// Base node of the iterator
klao@1158
   521
      ///
klao@1158
   522
      /// Returns the base node (the target in this case) of the iterator
klao@1158
   523
      Node baseNode(InEdgeIt e) const {
klao@1158
   524
	return target(e);
klao@1158
   525
      }
klao@1158
   526
      /// Running node of the iterator
klao@1158
   527
      ///
klao@1158
   528
      /// Returns the running node (the source in this case) of the
klao@1158
   529
      /// iterator
klao@1158
   530
      Node runningNode(InEdgeIt e) const {
klao@1158
   531
	return source(e);
klao@1158
   532
      }
klao@1158
   533
klao@1158
   534
      /// Base node of the iterator
klao@1158
   535
      ///
klao@1158
   536
      /// Returns the base node of the iterator
alpar@1367
   537
      Node baseNode(IncEdgeIt) const {
klao@1158
   538
	return INVALID;
klao@1158
   539
      }
klao@1158
   540
      /// Running node of the iterator
klao@1158
   541
      ///
klao@1158
   542
      /// Returns the running node of the iterator
alpar@1367
   543
      Node runningNode(IncEdgeIt) const {
klao@1158
   544
	return INVALID;
klao@1158
   545
      }
klao@1158
   546
klao@1158
   547
klao@1022
   548
      template <typename Graph>
klao@1022
   549
      struct Constraints {
klao@1022
   550
	void constraints() {
klao@1022
   551
	  checkConcept<BaseIterableUndirGraphConcept, Graph>();
klao@1022
   552
	  checkConcept<IterableUndirGraphConcept, Graph>();
klao@1022
   553
	  checkConcept<MappableUndirGraphConcept, Graph>();
klao@1022
   554
	}
klao@1022
   555
      };
klao@1022
   556
klao@1022
   557
    };
klao@1022
   558
klao@1022
   559
    class ExtendableUndirGraph : public UndirGraph {
klao@1022
   560
    public:
klao@1022
   561
klao@1022
   562
      template <typename Graph>
klao@1022
   563
      struct Constraints {
klao@1022
   564
	void constraints() {
klao@1022
   565
	  checkConcept<BaseIterableUndirGraphConcept, Graph>();
klao@1022
   566
	  checkConcept<IterableUndirGraphConcept, Graph>();
klao@1022
   567
	  checkConcept<MappableUndirGraphConcept, Graph>();
klao@1022
   568
klao@1022
   569
	  checkConcept<UndirGraph, Graph>();
klao@1022
   570
	  checkConcept<ExtendableUndirGraphConcept, Graph>();
klao@1022
   571
	  checkConcept<ClearableGraphComponent, Graph>();
klao@1022
   572
	}
klao@1022
   573
      };
klao@1022
   574
klao@1022
   575
    };
klao@1022
   576
klao@1022
   577
    class ErasableUndirGraph : public ExtendableUndirGraph {
klao@1022
   578
    public:
klao@1022
   579
klao@1022
   580
      template <typename Graph>
klao@1022
   581
      struct Constraints {
klao@1022
   582
	void constraints() {
klao@1022
   583
	  checkConcept<ExtendableUndirGraph, Graph>();
klao@1022
   584
	  checkConcept<ErasableUndirGraphConcept, Graph>();
klao@1022
   585
	}
klao@1022
   586
      };
klao@1022
   587
klao@962
   588
    };
klao@962
   589
klao@1030
   590
    /// @}
klao@1030
   591
klao@962
   592
  }
klao@962
   593
klao@962
   594
}
klao@962
   595
klao@962
   596
#endif