lemon/concept/ugraph.h
author alpar
Wed, 05 Jul 2006 16:59:45 +0000
changeset 2120 a907fb95f1e0
parent 2111 ea1fa1bc3f6d
child 2121 09a07a851506
permissions -rw-r--r--
As we agreed, Node/Edge::operator<() is required by the concept
klao@962
     1
/* -*- C++ -*-
klao@962
     2
 *
alpar@1956
     3
 * This file is a part of LEMON, a generic C++ optimization library
klao@962
     4
 *
alpar@1956
     5
 * Copyright (C) 2003-2006
alpar@1956
     6
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
alpar@1956
     7
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
klao@962
     8
 *
klao@962
     9
 * Permission to use, modify and distribute this software is granted
klao@962
    10
 * provided that this copyright notice appears in all copies. For
klao@962
    11
 * precise terms see the accompanying LICENSE file.
klao@962
    12
 *
klao@962
    13
 * This software is provided "AS IS" with no warranty of any kind,
klao@962
    14
 * express or implied, and with no claim as to its suitability for any
klao@962
    15
 * purpose.
klao@962
    16
 *
klao@962
    17
 */
klao@962
    18
klao@1030
    19
///\ingroup graph_concepts
klao@962
    20
///\file
deba@2111
    21
///\brief The concept of the undirected graphs.
klao@962
    22
klao@962
    23
deba@1910
    24
#ifndef LEMON_CONCEPT_UGRAPH_H
deba@1910
    25
#define LEMON_CONCEPT_UGRAPH_H
klao@962
    26
klao@962
    27
#include <lemon/concept/graph_component.h>
alpar@1620
    28
#include <lemon/concept/graph.h>
deba@1993
    29
#include <lemon/bits/utility.h>
klao@962
    30
klao@962
    31
namespace lemon {
klao@962
    32
  namespace concept {
klao@962
    33
alpar@1620
    34
    /// \addtogroup graph_concepts
alpar@1620
    35
    /// @{
alpar@1620
    36
alpar@1620
    37
klao@1030
    38
    /// Class describing the concept of Undirected Graphs.
klao@1030
    39
klao@1030
    40
    /// This class describes the common interface of all Undirected
klao@1030
    41
    /// Graphs.
klao@1030
    42
    ///
klao@1030
    43
    /// As all concept describing classes it provides only interface
klao@1030
    44
    /// without any sensible implementation. So any algorithm for
klao@1030
    45
    /// undirected graph should compile with this class, but it will not
klao@1030
    46
    /// run properly, of couse.
klao@1030
    47
    ///
klao@1030
    48
    /// In LEMON undirected graphs also fulfill the concept of directed
deba@2111
    49
    /// graphs (\ref lemon::concept::Graph "Graph Concept"). For
deba@2111
    50
    /// explanation of this and more see also the page \ref graphs,
deba@2111
    51
    /// a tutorial about graphs.
deba@1627
    52
    ///
deba@1627
    53
    /// You can assume that all undirected graph can be handled
deba@2111
    54
    /// as a directed graph. This way it is fully conform
deba@2111
    55
    /// to the Graph concept.
klao@1030
    56
klao@1909
    57
    class UGraph {
klao@1022
    58
    public:
alpar@1448
    59
      ///\e
alpar@1448
    60
alpar@1448
    61
      ///\todo undocumented
alpar@1448
    62
      ///
deba@1979
    63
      typedef True UndirectedTag;
klao@1022
    64
deba@1669
    65
      /// \brief The base type of node iterators, 
deba@1627
    66
      /// or in other words, the trivial node iterator.
deba@1669
    67
      ///
deba@1627
    68
      /// This is the base type of each node iterator,
deba@1627
    69
      /// thus each kind of node iterator converts to this.
deba@1627
    70
      /// More precisely each kind of node iterator should be inherited 
deba@1627
    71
      /// from the trivial node iterator.
deba@1627
    72
      class Node {
deba@1627
    73
      public:
deba@1627
    74
        /// Default constructor
deba@1627
    75
deba@1627
    76
        /// @warning The default constructor sets the iterator
deba@1627
    77
        /// to an undefined value.
deba@1627
    78
        Node() { }
deba@1627
    79
        /// Copy constructor.
deba@1627
    80
deba@1627
    81
        /// Copy constructor.
deba@1627
    82
        ///
deba@1627
    83
        Node(const Node&) { }
deba@1627
    84
deba@1627
    85
        /// Invalid constructor \& conversion.
deba@1627
    86
deba@1627
    87
        /// This constructor initializes the iterator to be invalid.
deba@1627
    88
        /// \sa Invalid for more details.
deba@1627
    89
        Node(Invalid) { }
deba@1627
    90
        /// Equality operator
deba@1627
    91
deba@1627
    92
        /// Two iterators are equal if and only if they point to the
deba@1627
    93
        /// same object or both are invalid.
deba@1627
    94
        bool operator==(Node) const { return true; }
deba@1627
    95
deba@1627
    96
        /// Inequality operator
deba@1627
    97
        
deba@1627
    98
        /// \sa operator==(Node n)
deba@1627
    99
        ///
deba@1627
   100
        bool operator!=(Node) const { return true; }
deba@1627
   101
deba@1627
   102
	/// Artificial ordering operator.
deba@1627
   103
	
deba@1627
   104
	/// To allow the use of graph descriptors as key type in std::map or
deba@1627
   105
	/// similar associative container we require this.
deba@1627
   106
	///
deba@1627
   107
	/// \note This operator only have to define some strict ordering of
deba@1627
   108
	/// the items; this order has nothing to do with the iteration
deba@1627
   109
	/// ordering of the items.
deba@1627
   110
	bool operator<(Node) const { return false; }
deba@1627
   111
deba@1627
   112
      };
deba@1627
   113
    
deba@1627
   114
      /// This iterator goes through each node.
deba@1627
   115
deba@1627
   116
      /// This iterator goes through each node.
deba@1627
   117
      /// Its usage is quite simple, for example you can count the number
deba@1627
   118
      /// of nodes in graph \c g of type \c Graph like this:
alpar@1946
   119
      ///\code
deba@1627
   120
      /// int count=0;
deba@1627
   121
      /// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count;
alpar@1946
   122
      ///\endcode
deba@1627
   123
      class NodeIt : public Node {
deba@1627
   124
      public:
deba@1627
   125
        /// Default constructor
deba@1627
   126
deba@1627
   127
        /// @warning The default constructor sets the iterator
deba@1627
   128
        /// to an undefined value.
deba@1627
   129
        NodeIt() { }
deba@1627
   130
        /// Copy constructor.
deba@1627
   131
        
deba@1627
   132
        /// Copy constructor.
deba@1627
   133
        ///
deba@1627
   134
        NodeIt(const NodeIt& n) : Node(n) { }
deba@1627
   135
        /// Invalid constructor \& conversion.
deba@1627
   136
deba@1627
   137
        /// Initialize the iterator to be invalid.
deba@1627
   138
        /// \sa Invalid for more details.
deba@1627
   139
        NodeIt(Invalid) { }
deba@1627
   140
        /// Sets the iterator to the first node.
deba@1627
   141
deba@1627
   142
        /// Sets the iterator to the first node of \c g.
deba@1627
   143
        ///
klao@1909
   144
        NodeIt(const UGraph&) { }
deba@1627
   145
        /// Node -> NodeIt conversion.
deba@1627
   146
deba@1627
   147
        /// Sets the iterator to the node of \c the graph pointed by 
deba@1627
   148
	/// the trivial iterator.
deba@1627
   149
        /// This feature necessitates that each time we 
deba@1627
   150
        /// iterate the edge-set, the iteration order is the same.
klao@1909
   151
        NodeIt(const UGraph&, const Node&) { }
deba@1627
   152
        /// Next node.
deba@1627
   153
deba@1627
   154
        /// Assign the iterator to the next node.
deba@1627
   155
        ///
deba@1627
   156
        NodeIt& operator++() { return *this; }
deba@1627
   157
      };
deba@1627
   158
    
deba@1627
   159
    
alpar@1620
   160
      /// The base type of the undirected edge iterators.
deba@1627
   161
alpar@1620
   162
      /// The base type of the undirected edge iterators.
alpar@1620
   163
      ///
klao@1909
   164
      class UEdge {
alpar@1620
   165
      public:
alpar@1620
   166
        /// Default constructor
klao@1030
   167
alpar@1620
   168
        /// @warning The default constructor sets the iterator
alpar@1620
   169
        /// to an undefined value.
klao@1909
   170
        UEdge() { }
alpar@1620
   171
        /// Copy constructor.
klao@1030
   172
alpar@1620
   173
        /// Copy constructor.
alpar@1620
   174
        ///
klao@1909
   175
        UEdge(const UEdge&) { }
alpar@1620
   176
        /// Initialize the iterator to be invalid.
klao@1030
   177
alpar@1620
   178
        /// Initialize the iterator to be invalid.
alpar@1620
   179
        ///
klao@1909
   180
        UEdge(Invalid) { }
alpar@1620
   181
        /// Equality operator
klao@1030
   182
alpar@1620
   183
        /// Two iterators are equal if and only if they point to the
alpar@1620
   184
        /// same object or both are invalid.
klao@1909
   185
        bool operator==(UEdge) const { return true; }
alpar@1620
   186
        /// Inequality operator
klao@1030
   187
klao@1909
   188
        /// \sa operator==(UEdge n)
alpar@1620
   189
        ///
klao@1909
   190
        bool operator!=(UEdge) const { return true; }
klao@1030
   191
deba@1627
   192
	/// Artificial ordering operator.
deba@1627
   193
	
deba@1627
   194
	/// To allow the use of graph descriptors as key type in std::map or
deba@1627
   195
	/// similar associative container we require this.
deba@1627
   196
	///
deba@1627
   197
	/// \note This operator only have to define some strict ordering of
deba@1627
   198
	/// the items; this order has nothing to do with the iteration
deba@1627
   199
	/// ordering of the items.
klao@1909
   200
	bool operator<(UEdge) const { return false; }
deba@1627
   201
      };
klao@1030
   202
alpar@1620
   203
      /// This iterator goes through each undirected edge.
klao@1030
   204
alpar@1620
   205
      /// This iterator goes through each undirected edge of a graph.
alpar@1620
   206
      /// Its usage is quite simple, for example you can count the number
deba@1627
   207
      /// of undirected edges in a graph \c g of type \c Graph as follows:
alpar@1946
   208
      ///\code
alpar@1620
   209
      /// int count=0;
klao@1909
   210
      /// for(Graph::UEdgeIt e(g); e!=INVALID; ++e) ++count;
alpar@1946
   211
      ///\endcode
klao@1909
   212
      class UEdgeIt : public UEdge {
alpar@1620
   213
      public:
alpar@1620
   214
        /// Default constructor
deba@1627
   215
alpar@1620
   216
        /// @warning The default constructor sets the iterator
alpar@1620
   217
        /// to an undefined value.
klao@1909
   218
        UEdgeIt() { }
alpar@1620
   219
        /// Copy constructor.
deba@1627
   220
alpar@1620
   221
        /// Copy constructor.
alpar@1620
   222
        ///
klao@1909
   223
        UEdgeIt(const UEdgeIt& e) : UEdge(e) { }
alpar@1620
   224
        /// Initialize the iterator to be invalid.
klao@1030
   225
alpar@1620
   226
        /// Initialize the iterator to be invalid.
alpar@1620
   227
        ///
klao@1909
   228
        UEdgeIt(Invalid) { }
deba@1627
   229
        /// This constructor sets the iterator to the first undirected edge.
alpar@1620
   230
    
deba@1627
   231
        /// This constructor sets the iterator to the first undirected edge.
klao@1909
   232
        UEdgeIt(const UGraph&) { }
klao@1909
   233
        /// UEdge -> UEdgeIt conversion
klao@1030
   234
deba@1627
   235
        /// Sets the iterator to the value of the trivial iterator.
deba@1627
   236
        /// This feature necessitates that each time we
deba@1627
   237
        /// iterate the undirected edge-set, the iteration order is the 
deba@1627
   238
	/// same.
klao@1909
   239
        UEdgeIt(const UGraph&, const UEdge&) { } 
deba@1627
   240
        /// Next undirected edge
alpar@1620
   241
        
deba@1627
   242
        /// Assign the iterator to the next undirected edge.
klao@1909
   243
        UEdgeIt& operator++() { return *this; }
alpar@1620
   244
      };
klao@1030
   245
deba@1627
   246
      /// \brief This iterator goes trough the incident undirected 
deba@1627
   247
      /// edges of a node.
deba@1627
   248
      ///
alpar@1620
   249
      /// This iterator goes trough the incident undirected edges
deba@2021
   250
      /// of a certain node of a graph. You should assume that the 
deba@2021
   251
      /// loop edges will be iterated twice.
deba@2021
   252
      /// 
alpar@1620
   253
      /// Its usage is quite simple, for example you can compute the
deba@2021
   254
      /// degree (i.e. count the number of incident edges of a node \c n
deba@2021
   255
      /// in graph \c g of type \c Graph as follows. 
deba@2021
   256
      ///
alpar@1946
   257
      ///\code
alpar@1620
   258
      /// int count=0;
alpar@1620
   259
      /// for(Graph::IncEdgeIt e(g, n); e!=INVALID; ++e) ++count;
alpar@1946
   260
      ///\endcode
klao@1909
   261
      class IncEdgeIt : public UEdge {
alpar@1620
   262
      public:
alpar@1620
   263
        /// Default constructor
klao@1030
   264
alpar@1620
   265
        /// @warning The default constructor sets the iterator
alpar@1620
   266
        /// to an undefined value.
alpar@1620
   267
        IncEdgeIt() { }
alpar@1620
   268
        /// Copy constructor.
alpar@1620
   269
alpar@1620
   270
        /// Copy constructor.
alpar@1620
   271
        ///
klao@1909
   272
        IncEdgeIt(const IncEdgeIt& e) : UEdge(e) { }
alpar@1620
   273
        /// Initialize the iterator to be invalid.
alpar@1620
   274
alpar@1620
   275
        /// Initialize the iterator to be invalid.
alpar@1620
   276
        ///
alpar@1620
   277
        IncEdgeIt(Invalid) { }
alpar@1620
   278
        /// This constructor sets the iterator to first incident edge.
alpar@1620
   279
    
alpar@1620
   280
        /// This constructor set the iterator to the first incident edge of
alpar@1620
   281
        /// the node.
klao@1909
   282
        IncEdgeIt(const UGraph&, const Node&) { }
klao@1909
   283
        /// UEdge -> IncEdgeIt conversion
alpar@1620
   284
alpar@1620
   285
        /// Sets the iterator to the value of the trivial iterator \c e.
alpar@1620
   286
        /// This feature necessitates that each time we 
alpar@1620
   287
        /// iterate the edge-set, the iteration order is the same.
klao@1909
   288
        IncEdgeIt(const UGraph&, const UEdge&) { }
alpar@1620
   289
        /// Next incident edge
alpar@1620
   290
alpar@1620
   291
        /// Assign the iterator to the next incident edge
alpar@1620
   292
	/// of the corresponding node.
alpar@1620
   293
        IncEdgeIt& operator++() { return *this; }
alpar@1620
   294
      };
alpar@1620
   295
deba@1627
   296
      /// The directed edge type.
deba@1627
   297
deba@1627
   298
      /// The directed edge type. It can be converted to the
deba@1627
   299
      /// undirected edge.
klao@1909
   300
      class Edge : public UEdge {
deba@1627
   301
      public:
deba@1627
   302
        /// Default constructor
deba@1627
   303
deba@1627
   304
        /// @warning The default constructor sets the iterator
deba@1627
   305
        /// to an undefined value.
deba@1627
   306
        Edge() { }
deba@1627
   307
        /// Copy constructor.
deba@1627
   308
deba@1627
   309
        /// Copy constructor.
deba@1627
   310
        ///
klao@1909
   311
        Edge(const Edge& e) : UEdge(e) { }
deba@1627
   312
        /// Initialize the iterator to be invalid.
deba@1627
   313
deba@1627
   314
        /// Initialize the iterator to be invalid.
deba@1627
   315
        ///
deba@1627
   316
        Edge(Invalid) { }
deba@1627
   317
        /// Equality operator
deba@1627
   318
deba@1627
   319
        /// Two iterators are equal if and only if they point to the
deba@1627
   320
        /// same object or both are invalid.
deba@1627
   321
        bool operator==(Edge) const { return true; }
deba@1627
   322
        /// Inequality operator
deba@1627
   323
deba@1627
   324
        /// \sa operator==(Edge n)
deba@1627
   325
        ///
deba@1627
   326
        bool operator!=(Edge) const { return true; }
deba@1627
   327
deba@1627
   328
	/// Artificial ordering operator.
deba@1627
   329
	
deba@1627
   330
	/// To allow the use of graph descriptors as key type in std::map or
deba@1627
   331
	/// similar associative container we require this.
deba@1627
   332
	///
deba@1627
   333
	/// \note This operator only have to define some strict ordering of
deba@1627
   334
	/// the items; this order has nothing to do with the iteration
deba@1627
   335
	/// ordering of the items.
deba@1627
   336
	bool operator<(Edge) const { return false; }
deba@1627
   337
	
deba@1627
   338
      }; 
deba@1627
   339
      /// This iterator goes through each directed edge.
deba@1627
   340
deba@1627
   341
      /// This iterator goes through each edge of a graph.
deba@1627
   342
      /// Its usage is quite simple, for example you can count the number
deba@1627
   343
      /// of edges in a graph \c g of type \c Graph as follows:
alpar@1946
   344
      ///\code
deba@1627
   345
      /// int count=0;
deba@1627
   346
      /// for(Graph::EdgeIt e(g); e!=INVALID; ++e) ++count;
alpar@1946
   347
      ///\endcode
deba@1627
   348
      class EdgeIt : public Edge {
deba@1627
   349
      public:
deba@1627
   350
        /// Default constructor
deba@1627
   351
deba@1627
   352
        /// @warning The default constructor sets the iterator
deba@1627
   353
        /// to an undefined value.
deba@1627
   354
        EdgeIt() { }
deba@1627
   355
        /// Copy constructor.
deba@1627
   356
deba@1627
   357
        /// Copy constructor.
deba@1627
   358
        ///
deba@1627
   359
        EdgeIt(const EdgeIt& e) : Edge(e) { }
deba@1627
   360
        /// Initialize the iterator to be invalid.
deba@1627
   361
deba@1627
   362
        /// Initialize the iterator to be invalid.
deba@1627
   363
        ///
deba@1627
   364
        EdgeIt(Invalid) { }
deba@1627
   365
        /// This constructor sets the iterator to the first edge.
deba@1627
   366
    
deba@1627
   367
        /// This constructor sets the iterator to the first edge of \c g.
deba@1627
   368
        ///@param g the graph
klao@1909
   369
        EdgeIt(const UGraph &g) { ignore_unused_variable_warning(g); }
deba@1627
   370
        /// Edge -> EdgeIt conversion
deba@1627
   371
deba@1627
   372
        /// Sets the iterator to the value of the trivial iterator \c e.
deba@1627
   373
        /// This feature necessitates that each time we 
deba@1627
   374
        /// iterate the edge-set, the iteration order is the same.
klao@1909
   375
        EdgeIt(const UGraph&, const Edge&) { } 
deba@1627
   376
        ///Next edge
deba@1627
   377
        
deba@1627
   378
        /// Assign the iterator to the next edge.
deba@1627
   379
        EdgeIt& operator++() { return *this; }
deba@1627
   380
      };
deba@1627
   381
   
deba@1627
   382
      /// This iterator goes trough the outgoing directed edges of a node.
deba@1627
   383
deba@1627
   384
      /// This iterator goes trough the \e outgoing edges of a certain node
deba@1627
   385
      /// of a graph.
deba@1627
   386
      /// Its usage is quite simple, for example you can count the number
deba@1627
   387
      /// of outgoing edges of a node \c n
deba@1627
   388
      /// in graph \c g of type \c Graph as follows.
alpar@1946
   389
      ///\code
deba@1627
   390
      /// int count=0;
deba@1627
   391
      /// for (Graph::OutEdgeIt e(g, n); e!=INVALID; ++e) ++count;
alpar@1946
   392
      ///\endcode
deba@1627
   393
    
deba@1627
   394
      class OutEdgeIt : public Edge {
deba@1627
   395
      public:
deba@1627
   396
        /// Default constructor
deba@1627
   397
deba@1627
   398
        /// @warning The default constructor sets the iterator
deba@1627
   399
        /// to an undefined value.
deba@1627
   400
        OutEdgeIt() { }
deba@1627
   401
        /// Copy constructor.
deba@1627
   402
deba@1627
   403
        /// Copy constructor.
deba@1627
   404
        ///
deba@1627
   405
        OutEdgeIt(const OutEdgeIt& e) : Edge(e) { }
deba@1627
   406
        /// Initialize the iterator to be invalid.
deba@1627
   407
deba@1627
   408
        /// Initialize the iterator to be invalid.
deba@1627
   409
        ///
deba@1627
   410
        OutEdgeIt(Invalid) { }
deba@1627
   411
        /// This constructor sets the iterator to the first outgoing edge.
deba@1627
   412
    
deba@1627
   413
        /// This constructor sets the iterator to the first outgoing edge of
deba@1627
   414
        /// the node.
deba@1627
   415
        ///@param n the node
deba@1627
   416
        ///@param g the graph
klao@1909
   417
        OutEdgeIt(const UGraph& n, const Node& g) {
alpar@1643
   418
	  ignore_unused_variable_warning(n);
alpar@1643
   419
	  ignore_unused_variable_warning(g);
alpar@1643
   420
	}
deba@1627
   421
        /// Edge -> OutEdgeIt conversion
deba@1627
   422
deba@1627
   423
        /// Sets the iterator to the value of the trivial iterator.
deba@1627
   424
	/// This feature necessitates that each time we 
deba@1627
   425
        /// iterate the edge-set, the iteration order is the same.
klao@1909
   426
        OutEdgeIt(const UGraph&, const Edge&) { }
deba@1627
   427
        ///Next outgoing edge
deba@1627
   428
        
deba@1627
   429
        /// Assign the iterator to the next 
deba@1627
   430
        /// outgoing edge of the corresponding node.
deba@1627
   431
        OutEdgeIt& operator++() { return *this; }
deba@1627
   432
      };
deba@1627
   433
deba@1627
   434
      /// This iterator goes trough the incoming directed edges of a node.
deba@1627
   435
deba@1627
   436
      /// This iterator goes trough the \e incoming edges of a certain node
deba@1627
   437
      /// of a graph.
deba@1627
   438
      /// Its usage is quite simple, for example you can count the number
deba@1627
   439
      /// of outgoing edges of a node \c n
deba@1627
   440
      /// in graph \c g of type \c Graph as follows.
alpar@1946
   441
      ///\code
deba@1627
   442
      /// int count=0;
deba@1627
   443
      /// for(Graph::InEdgeIt e(g, n); e!=INVALID; ++e) ++count;
alpar@1946
   444
      ///\endcode
deba@1627
   445
deba@1627
   446
      class InEdgeIt : public Edge {
deba@1627
   447
      public:
deba@1627
   448
        /// Default constructor
deba@1627
   449
deba@1627
   450
        /// @warning The default constructor sets the iterator
deba@1627
   451
        /// to an undefined value.
deba@1627
   452
        InEdgeIt() { }
deba@1627
   453
        /// Copy constructor.
deba@1627
   454
deba@1627
   455
        /// Copy constructor.
deba@1627
   456
        ///
deba@1627
   457
        InEdgeIt(const InEdgeIt& e) : Edge(e) { }
deba@1627
   458
        /// Initialize the iterator to be invalid.
deba@1627
   459
deba@1627
   460
        /// Initialize the iterator to be invalid.
deba@1627
   461
        ///
deba@1627
   462
        InEdgeIt(Invalid) { }
deba@1627
   463
        /// This constructor sets the iterator to first incoming edge.
deba@1627
   464
    
deba@1627
   465
        /// This constructor set the iterator to the first incoming edge of
deba@1627
   466
        /// the node.
deba@1627
   467
        ///@param n the node
deba@1627
   468
        ///@param g the graph
klao@1909
   469
        InEdgeIt(const UGraph& g, const Node& n) { 
alpar@1643
   470
	  ignore_unused_variable_warning(n);
alpar@1643
   471
	  ignore_unused_variable_warning(g);
alpar@1643
   472
	}
deba@1627
   473
        /// Edge -> InEdgeIt conversion
deba@1627
   474
deba@1627
   475
        /// Sets the iterator to the value of the trivial iterator \c e.
deba@1627
   476
        /// This feature necessitates that each time we 
deba@1627
   477
        /// iterate the edge-set, the iteration order is the same.
klao@1909
   478
        InEdgeIt(const UGraph&, const Edge&) { }
deba@1627
   479
        /// Next incoming edge
deba@1627
   480
deba@1627
   481
        /// Assign the iterator to the next inedge of the corresponding node.
deba@1627
   482
        ///
deba@1627
   483
        InEdgeIt& operator++() { return *this; }
deba@1627
   484
      };
deba@1627
   485
deba@1627
   486
      /// \brief Read write map of the nodes to type \c T.
deba@1627
   487
      /// 
deba@1627
   488
      /// ReadWrite map of the nodes to type \c T.
deba@1627
   489
      /// \sa Reference
deba@1627
   490
      /// \warning Making maps that can handle bool type (NodeMap<bool>)
deba@1627
   491
      /// needs some extra attention!
alpar@1630
   492
      /// \todo Wrong documentation
deba@1627
   493
      template<class T> 
deba@1627
   494
      class NodeMap : public ReadWriteMap< Node, T >
deba@1627
   495
      {
deba@1627
   496
      public:
deba@1627
   497
deba@1627
   498
        ///\e
klao@1909
   499
        NodeMap(const UGraph&) { }
deba@1627
   500
        ///\e
klao@1909
   501
        NodeMap(const UGraph&, T) { }
deba@1627
   502
deba@1627
   503
        ///Copy constructor
deba@1627
   504
        NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
deba@1627
   505
        ///Assignment operator
deba@1627
   506
        NodeMap& operator=(const NodeMap&) { return *this; }
deba@1627
   507
        // \todo fix this concept
deba@1627
   508
      };
deba@1627
   509
deba@1627
   510
      /// \brief Read write map of the directed edges to type \c T.
deba@1627
   511
      ///
deba@1627
   512
      /// Reference map of the directed edges to type \c T.
deba@1627
   513
      /// \sa Reference
deba@1627
   514
      /// \warning Making maps that can handle bool type (EdgeMap<bool>)
deba@1627
   515
      /// needs some extra attention!
alpar@1630
   516
      /// \todo Wrong documentation
deba@1627
   517
      template<class T> 
deba@1627
   518
      class EdgeMap : public ReadWriteMap<Edge,T>
deba@1627
   519
      {
deba@1627
   520
      public:
deba@1627
   521
deba@1627
   522
        ///\e
klao@1909
   523
        EdgeMap(const UGraph&) { }
deba@1627
   524
        ///\e
klao@1909
   525
        EdgeMap(const UGraph&, T) { }
deba@1627
   526
        ///Copy constructor
deba@1627
   527
        EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) { }
deba@1627
   528
        ///Assignment operator
deba@1627
   529
        EdgeMap& operator=(const EdgeMap&) { return *this; }
deba@1627
   530
        // \todo fix this concept    
deba@1627
   531
      };
deba@1627
   532
alpar@1620
   533
      /// Read write map of the undirected edges to type \c T.
alpar@1620
   534
alpar@1620
   535
      /// Reference map of the edges to type \c T.
alpar@1620
   536
      /// \sa Reference
klao@1909
   537
      /// \warning Making maps that can handle bool type (UEdgeMap<bool>)
alpar@1620
   538
      /// needs some extra attention!
alpar@1630
   539
      /// \todo Wrong documentation
alpar@1620
   540
      template<class T> 
klao@1909
   541
      class UEdgeMap : public ReadWriteMap<UEdge,T>
alpar@1620
   542
      {
klao@1030
   543
      public:
klao@1030
   544
alpar@1620
   545
        ///\e
klao@1909
   546
        UEdgeMap(const UGraph&) { }
alpar@1620
   547
        ///\e
klao@1909
   548
        UEdgeMap(const UGraph&, T) { }
alpar@1620
   549
        ///Copy constructor
klao@1909
   550
        UEdgeMap(const UEdgeMap& em) : ReadWriteMap<UEdge,T>(em) {}
alpar@1620
   551
        ///Assignment operator
klao@1909
   552
        UEdgeMap &operator=(const UEdgeMap&) { return *this; }
alpar@1620
   553
        // \todo fix this concept    
klao@1030
   554
      };
klao@1030
   555
deba@1627
   556
      /// \brief Direct the given undirected edge.
deba@1627
   557
      ///
deba@1627
   558
      /// Direct the given undirected edge. The returned edge source
deba@1627
   559
      /// will be the given edge.
klao@1909
   560
      Edge direct(const UEdge&, const Node&) const {
deba@1627
   561
	return INVALID;
deba@1627
   562
      }
klao@1030
   563
deba@1627
   564
      /// \brief Direct the given undirected edge.
deba@1627
   565
      ///
deba@1627
   566
      /// Direct the given undirected edge. The returned edge source
deba@1627
   567
      /// will be the source of the undirected edge if the given bool
deba@1627
   568
      /// is true.
klao@1909
   569
      Edge direct(const UEdge&, bool) const {
deba@1627
   570
	return INVALID;
deba@1627
   571
      }
deba@1627
   572
deba@1627
   573
      /// \brief Returns true if the edge has default orientation.
deba@1627
   574
      ///
klao@1030
   575
      /// Returns whether the given directed edge is same orientation as
klao@1030
   576
      /// the corresponding undirected edge.
deba@1627
   577
      bool direction(Edge) const { return true; }
deba@1627
   578
deba@1627
   579
      /// \brief Returns the opposite directed edge.
klao@1030
   580
      ///
deba@1627
   581
      /// Returns the opposite directed edge.
deba@1627
   582
      Edge oppositeEdge(Edge) const { return INVALID; }
klao@1030
   583
deba@1627
   584
      /// \brief Opposite node on an edge
deba@1627
   585
      ///
klao@1030
   586
      /// \return the opposite of the given Node on the given Edge
klao@1909
   587
      Node oppositeNode(Node, UEdge) const { return INVALID; }
klao@1030
   588
deba@1627
   589
      /// \brief First node of the undirected edge.
deba@1627
   590
      ///
klao@1909
   591
      /// \return the first node of the given UEdge.
klao@1030
   592
      ///
klao@1909
   593
      /// Naturally uectected edges don't have direction and thus
klao@1030
   594
      /// don't have source and target node. But we use these two methods
klao@1030
   595
      /// to query the two endnodes of the edge. The direction of the edge
klao@1030
   596
      /// which arises this way is called the inherent direction of the
deba@1627
   597
      /// undirected edge, and is used to define the "default" direction
klao@1030
   598
      /// of the directed versions of the edges.
deba@1627
   599
      /// \sa direction
klao@1909
   600
      Node source(UEdge) const { return INVALID; }
klao@1030
   601
deba@1627
   602
      /// \brief Second node of the undirected edge.
klao@1909
   603
      Node target(UEdge) const { return INVALID; }
klao@1030
   604
deba@1627
   605
      /// \brief Source node of the directed edge.
klao@1030
   606
      Node source(Edge) const { return INVALID; }
klao@1030
   607
deba@1627
   608
      /// \brief Target node of the directed edge.
klao@1030
   609
      Node target(Edge) const { return INVALID; }
klao@1030
   610
klao@1030
   611
      void first(Node&) const {}
klao@1030
   612
      void next(Node&) const {}
klao@1030
   613
klao@1909
   614
      void first(UEdge&) const {}
klao@1909
   615
      void next(UEdge&) const {}
klao@1030
   616
klao@1030
   617
      void first(Edge&) const {}
klao@1030
   618
      void next(Edge&) const {}
klao@1030
   619
klao@1030
   620
      void firstOut(Edge&, Node) const {}
klao@1030
   621
      void nextOut(Edge&) const {}
klao@1030
   622
klao@1030
   623
      void firstIn(Edge&, Node) const {}
klao@1030
   624
      void nextIn(Edge&) const {}
klao@1030
   625
klao@1030
   626
deba@1980
   627
      void firstInc(UEdge &, bool &, const Node &) const {}
deba@1980
   628
      void nextInc(UEdge &, bool &) const {}
deba@1980
   629
deba@1627
   630
      /// \brief Base node of the iterator
klao@1158
   631
      ///
klao@1158
   632
      /// Returns the base node (the source in this case) of the iterator
klao@1158
   633
      Node baseNode(OutEdgeIt e) const {
klao@1158
   634
	return source(e);
klao@1158
   635
      }
deba@1627
   636
      /// \brief Running node of the iterator
klao@1158
   637
      ///
klao@1158
   638
      /// Returns the running node (the target in this case) of the
klao@1158
   639
      /// iterator
klao@1158
   640
      Node runningNode(OutEdgeIt e) const {
klao@1158
   641
	return target(e);
klao@1158
   642
      }
klao@1158
   643
deba@1627
   644
      /// \brief Base node of the iterator
klao@1158
   645
      ///
klao@1158
   646
      /// Returns the base node (the target in this case) of the iterator
klao@1158
   647
      Node baseNode(InEdgeIt e) const {
klao@1158
   648
	return target(e);
klao@1158
   649
      }
deba@1627
   650
      /// \brief Running node of the iterator
klao@1158
   651
      ///
klao@1158
   652
      /// Returns the running node (the source in this case) of the
klao@1158
   653
      /// iterator
klao@1158
   654
      Node runningNode(InEdgeIt e) const {
klao@1158
   655
	return source(e);
klao@1158
   656
      }
klao@1158
   657
deba@1627
   658
      /// \brief Base node of the iterator
klao@1158
   659
      ///
klao@1158
   660
      /// Returns the base node of the iterator
alpar@1367
   661
      Node baseNode(IncEdgeIt) const {
klao@1158
   662
	return INVALID;
klao@1158
   663
      }
deba@1627
   664
      
deba@1627
   665
      /// \brief Running node of the iterator
klao@1158
   666
      ///
klao@1158
   667
      /// Returns the running node of the iterator
alpar@1367
   668
      Node runningNode(IncEdgeIt) const {
klao@1158
   669
	return INVALID;
klao@1158
   670
      }
klao@1158
   671
klao@1022
   672
      template <typename Graph>
klao@1022
   673
      struct Constraints {
klao@1022
   674
	void constraints() {
klao@1909
   675
	  checkConcept<BaseIterableUGraphConcept, Graph>();
klao@1909
   676
	  checkConcept<IterableUGraphConcept, Graph>();
klao@1909
   677
	  checkConcept<MappableUGraphConcept, Graph>();
klao@1022
   678
	}
klao@1022
   679
      };
klao@1022
   680
klao@1022
   681
    };
klao@1022
   682
klao@1030
   683
    /// @}
klao@1030
   684
klao@962
   685
  }
klao@962
   686
klao@962
   687
}
klao@962
   688
klao@962
   689
#endif