COIN-OR::LEMON - Graph Library

Changes in / [598:a3402913cffe:599:f63e87b9748e] in lemon-main


Ignore:
Files:
6 added
64 edited

Legend:

Unmodified
Added
Removed
  • doc/CMakeLists.txt

    r549 r586  
    1515      COMMAND rm -rf gen-images
    1616      COMMAND mkdir gen-images
     17      COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/bipartite_matching.png ${CMAKE_CURRENT_SOURCE_DIR}/images/bipartite_matching.eps
     18      COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/bipartite_partitions.png ${CMAKE_CURRENT_SOURCE_DIR}/images/bipartite_partitions.eps
     19      COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/connected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/connected_components.eps
     20      COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/edge_biconnected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/edge_biconnected_components.eps
    1721      COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/grid_graph.png ${CMAKE_CURRENT_SOURCE_DIR}/images/grid_graph.eps
     22      COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/node_biconnected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/node_biconnected_components.eps
    1823      COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_0.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_0.eps
    1924      COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_1.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_1.eps
     
    2126      COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_3.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_3.eps
    2227      COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_4.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_4.eps
     28      COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/strongly_connected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/strongly_connected_components.eps
    2329      COMMAND rm -rf html
    2430      COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile
     
    2834      COMMAND if exist gen-images rmdir /s /q gen-images
    2935      COMMAND mkdir gen-images
     36      COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/bipartite_matching.png ${CMAKE_CURRENT_SOURCE_DIR}/images/bipartite_matching.eps
     37      COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/bipartite_partitions.png ${CMAKE_CURRENT_SOURCE_DIR}/images/bipartite_partitions.eps
     38      COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/connected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/connected_components.eps
     39      COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/edge_biconnected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/edge_biconnected_components.eps
     40      COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/grid_graph.png ${CMAKE_CURRENT_SOURCE_DIR}/images/grid_graph.eps
     41      COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/node_biconnected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/node_biconnected_components.eps
    3042      COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_0.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_0.eps
    3143      COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_1.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_1.eps
     
    3345      COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_3.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_3.eps
    3446      COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_4.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_4.eps
     47      COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/strongly_connected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/strongly_connected_components.eps
    3548      COMMAND if exist html rmdir /s /q html
    3649      COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile
  • doc/Makefile.am

    r337 r587  
    2222        nodeshape_4.eps
    2323
     24DOC_EPS_IMAGES27 = \
     25        bipartite_matching.eps \
     26        bipartite_partitions.eps \
     27        connected_components.eps \
     28        edge_biconnected_components.eps \
     29        node_biconnected_components.eps \
     30        strongly_connected_components.eps
     31
    2432DOC_EPS_IMAGES = \
    25         $(DOC_EPS_IMAGES18)
     33        $(DOC_EPS_IMAGES18) \
     34        $(DOC_EPS_IMAGES27)
    2635
    2736DOC_PNG_IMAGES = \
     
    3948        if test ${gs_found} = yes; then \
    4049          $(GS_COMMAND) -sDEVICE=pngalpha -r18 -sOutputFile=$@ $<; \
     50        else \
     51          echo; \
     52          echo "Ghostscript not found."; \
     53          echo; \
     54          exit 1; \
     55        fi
     56
     57$(DOC_EPS_IMAGES27:%.eps=doc/gen-images/%.png): doc/gen-images/%.png: doc/images/%.eps
     58        -mkdir doc/gen-images
     59        if test ${gs_found} = yes; then \
     60          $(GS_COMMAND) -sDEVICE=pngalpha -r27 -sOutputFile=$@ $<; \
    4161        else \
    4262          echo; \
  • doc/groups.dox

    r564 r586  
    408408
    409409/**
    410 @defgroup graph_prop Connectivity and Other Graph Properties
     410@defgroup graph_properties Connectivity and Other Graph Properties
    411411@ingroup algs
    412412\brief Algorithms for discovering the graph properties
  • lemon/adaptors.h

    r559 r579  
    21932193    typedef typename ItemSetTraits<DGR, Edge>::ItemNotifier EdgeNotifier;
    21942194    EdgeNotifier& notifier(Edge) const { return _digraph->notifier(Edge()); }
     2195   
     2196    typedef EdgeNotifier ArcNotifier;
     2197    ArcNotifier& notifier(Arc) const { return _digraph->notifier(Edge()); }
    21952198
    21962199  protected:
  • lemon/bin_heap.h

    r559 r584  
    7474    /// \c PRE_HEAP (<tt>-1</tt>) to any element to be put in the heap.
    7575    enum State {
    76       IN_HEAP = 0,    ///< \e
    77       PRE_HEAP = -1,  ///< \e
    78       POST_HEAP = -2  ///< \e
     76      IN_HEAP = 0,    ///< = 0.
     77      PRE_HEAP = -1,  ///< = -1.
     78      POST_HEAP = -2  ///< = -2.
    7979    };
    8080
  • lemon/bits/graph_adaptor_extender.h

    r455 r580  
    2222#include <lemon/core.h>
    2323#include <lemon/error.h>
    24 
    25 #include <lemon/bits/default_map.h>
    2624
    2725namespace lemon {
  • lemon/bits/map_extender.h

    r440 r580  
    4848    typedef typename Parent::Key Key;
    4949    typedef typename Parent::Value Value;
     50    typedef typename Parent::Reference Reference;
     51    typedef typename Parent::ConstReference ConstReference;
    5052
    5153    class MapIt;
     
    188190    typedef typename Parent::Key Key;
    189191    typedef typename Parent::Value Value;
     192    typedef typename Parent::Reference Reference;
     193    typedef typename Parent::ConstReference ConstReference;
    190194
    191195    class MapIt;
  • lemon/cbc.cc

    r567 r576  
    5656    _osi_solver = 0;
    5757    _cbc_model = 0;
     58    messageLevel(MESSAGE_NOTHING);
    5859  }
    5960
    6061  CbcMip::CbcMip(const CbcMip& other) {
    6162    _prob = new CoinModel(*other._prob);
     63    _prob->setProblemName("LEMON");
    6264    _osi_solver = 0;
    6365    _cbc_model = 0;
     66    messageLevel(MESSAGE_NOTHING);
    6467  }
    6568
     
    271274    _cbc_model= new CbcModel(*_osi_solver);
    272275
    273     switch (_message_level) {
    274     case MESSAGE_NO_OUTPUT:
    275       _osi_solver->messageHandler()->setLogLevel(0);
    276       _cbc_model->setLogLevel(0);
    277       break;
    278     case MESSAGE_ERROR_MESSAGE:
    279       _osi_solver->messageHandler()->setLogLevel(1);
    280       _cbc_model->setLogLevel(1);
    281       break;
    282     case MESSAGE_NORMAL_OUTPUT:
    283       _osi_solver->messageHandler()->setLogLevel(2);
    284       _cbc_model->setLogLevel(2);
    285       break;
    286     case MESSAGE_FULL_OUTPUT:
    287       _osi_solver->messageHandler()->setLogLevel(3);
    288       _cbc_model->setLogLevel(3);
    289       break;
    290     }
     276    _osi_solver->messageHandler()->setLogLevel(_message_level);
     277    _cbc_model->setLogLevel(_message_level);
    291278
    292279    _cbc_model->initialSolve();
     
    454441  }
    455442
    456   void CbcMip::messageLevel(MessageLevel m) {
    457     _message_level = m;
     443  void CbcMip::_messageLevel(MessageLevel level) {
     444    switch (level) {
     445    case MESSAGE_NOTHING:
     446      _message_level = 0;
     447      break;
     448    case MESSAGE_ERROR:
     449      _message_level = 1;
     450      break;
     451    case MESSAGE_WARNING:
     452      _message_level = 1;
     453      break;
     454    case MESSAGE_NORMAL:
     455      _message_level = 2;
     456      break;
     457    case MESSAGE_VERBOSE:
     458      _message_level = 3;
     459      break;
     460    }
    458461  }
    459462
  • lemon/cbc.h

    r567 r576  
    116116    virtual void _clear();
    117117
    118   public:
     118    virtual void _messageLevel(MessageLevel level);
     119    void _applyMessageLevel();
    119120
    120     ///Enum for \c messageLevel() parameter
    121     enum MessageLevel {
    122       /// no output (default value)
    123       MESSAGE_NO_OUTPUT = 0,
    124       /// error messages only
    125       MESSAGE_ERROR_MESSAGE = 1,
    126       /// normal output
    127       MESSAGE_NORMAL_OUTPUT = 2,
    128       /// full output (includes informational messages)
    129       MESSAGE_FULL_OUTPUT = 3
    130     };
     121    int _message_level;
    131122
    132   private:
    133 
    134     MessageLevel _message_level;
    135 
    136   public:
    137 
    138     ///Set the verbosity of the messages
    139 
    140     ///Set the verbosity of the messages
    141     ///
    142     ///\param m is the level of the messages output by the solver routines.
    143     void messageLevel(MessageLevel m);
    144 
     123   
    145124
    146125  };
  • lemon/circulation.h

    r559 r581  
    454454
    455455      for(NodeIt n(_g);n!=INVALID;++n) {
    456         _excess->set(n, (*_delta)[n]);
     456        (*_excess)[n] = (*_delta)[n];
    457457      }
    458458
    459459      for (ArcIt e(_g);e!=INVALID;++e) {
    460460        _flow->set(e, (*_lo)[e]);
    461         _excess->set(_g.target(e), (*_excess)[_g.target(e)] + (*_flow)[e]);
    462         _excess->set(_g.source(e), (*_excess)[_g.source(e)] - (*_flow)[e]);
     461        (*_excess)[_g.target(e)] += (*_flow)[e];
     462        (*_excess)[_g.source(e)] -= (*_flow)[e];
    463463      }
    464464
     
    483483
    484484      for(NodeIt n(_g);n!=INVALID;++n) {
    485         _excess->set(n, (*_delta)[n]);
     485        (*_excess)[n] = (*_delta)[n];
    486486      }
    487487
     
    489489        if (!_tol.positive((*_excess)[_g.target(e)] + (*_up)[e])) {
    490490          _flow->set(e, (*_up)[e]);
    491           _excess->set(_g.target(e), (*_excess)[_g.target(e)] + (*_up)[e]);
    492           _excess->set(_g.source(e), (*_excess)[_g.source(e)] - (*_up)[e]);
     491          (*_excess)[_g.target(e)] += (*_up)[e];
     492          (*_excess)[_g.source(e)] -= (*_up)[e];
    493493        } else if (_tol.positive((*_excess)[_g.target(e)] + (*_lo)[e])) {
    494494          _flow->set(e, (*_lo)[e]);
    495           _excess->set(_g.target(e), (*_excess)[_g.target(e)] + (*_lo)[e]);
    496           _excess->set(_g.source(e), (*_excess)[_g.source(e)] - (*_lo)[e]);
     495          (*_excess)[_g.target(e)] += (*_lo)[e];
     496          (*_excess)[_g.source(e)] -= (*_lo)[e];
    497497        } else {
    498498          Value fc = -(*_excess)[_g.target(e)];
    499499          _flow->set(e, fc);
    500           _excess->set(_g.target(e), 0);
    501           _excess->set(_g.source(e), (*_excess)[_g.source(e)] - fc);
     500          (*_excess)[_g.target(e)] = 0;
     501          (*_excess)[_g.source(e)] -= fc;
    502502        }
    503503      }
     
    538538            if(!_tol.less(fc, exc)) {
    539539              _flow->set(e, (*_flow)[e] + exc);
    540               _excess->set(v, (*_excess)[v] + exc);
     540              (*_excess)[v] += exc;
    541541              if(!_level->active(v) && _tol.positive((*_excess)[v]))
    542542                _level->activate(v);
    543               _excess->set(act,0);
     543              (*_excess)[act] = 0;
    544544              _level->deactivate(act);
    545545              goto next_l;
     
    547547            else {
    548548              _flow->set(e, (*_up)[e]);
    549               _excess->set(v, (*_excess)[v] + fc);
     549              (*_excess)[v] += fc;
    550550              if(!_level->active(v) && _tol.positive((*_excess)[v]))
    551551                _level->activate(v);
     
    562562            if(!_tol.less(fc, exc)) {
    563563              _flow->set(e, (*_flow)[e] - exc);
    564               _excess->set(v, (*_excess)[v] + exc);
     564              (*_excess)[v] += exc;
    565565              if(!_level->active(v) && _tol.positive((*_excess)[v]))
    566566                _level->activate(v);
    567               _excess->set(act,0);
     567              (*_excess)[act] = 0;
    568568              _level->deactivate(act);
    569569              goto next_l;
     
    571571            else {
    572572              _flow->set(e, (*_lo)[e]);
    573               _excess->set(v, (*_excess)[v] + fc);
     573              (*_excess)[v] += fc;
    574574              if(!_level->active(v) && _tol.positive((*_excess)[v]))
    575575                _level->activate(v);
     
    580580        }
    581581
    582         _excess->set(act, exc);
     582        (*_excess)[act] = exc;
    583583        if(!_tol.positive(exc)) _level->deactivate(act);
    584584        else if(mlevel==_node_num) {
  • lemon/clp.cc

    r540 r576  
    2525    _prob = new ClpSimplex();
    2626    _init_temporals();
    27     messageLevel(MESSAGE_NO_OUTPUT);
     27    messageLevel(MESSAGE_NOTHING);
    2828  }
    2929
     
    3333    cols = other.cols;
    3434    _init_temporals();
    35     messageLevel(MESSAGE_NO_OUTPUT);
     35    messageLevel(MESSAGE_NOTHING);
    3636  }
    3737
     
    431431  }
    432432
    433   void ClpLp::messageLevel(MessageLevel m) {
    434     _prob->setLogLevel(static_cast<int>(m));
     433  void ClpLp::_messageLevel(MessageLevel level) {
     434    switch (level) {
     435    case MESSAGE_NOTHING:
     436      _prob->setLogLevel(0);
     437      break;
     438    case MESSAGE_ERROR:
     439      _prob->setLogLevel(1);
     440      break;
     441    case MESSAGE_WARNING:
     442      _prob->setLogLevel(2);
     443      break;
     444    case MESSAGE_NORMAL:
     445      _prob->setLogLevel(3);
     446      break;
     447    case MESSAGE_VERBOSE:
     448      _prob->setLogLevel(4);
     449      break;
     450    }
    435451  }
    436452
  • lemon/clp.h

    r540 r576  
    137137    virtual void _clear();
    138138
     139    virtual void _messageLevel(MessageLevel);
     140   
    139141  public:
    140142
     
    154156    int clpCol(Col c) const { return cols(id(c)); }
    155157
    156     ///Enum for \c messageLevel() parameter
    157     enum MessageLevel {
    158       /// no output (default value)
    159       MESSAGE_NO_OUTPUT = 0,
    160       /// print final solution
    161       MESSAGE_FINAL_SOLUTION = 1,
    162       /// print factorization
    163       MESSAGE_FACTORIZATION = 2,
    164       /// normal output
    165       MESSAGE_NORMAL_OUTPUT = 3,
    166       /// verbose output
    167       MESSAGE_VERBOSE_OUTPUT = 4
    168     };
    169     ///Set the verbosity of the messages
    170 
    171     ///Set the verbosity of the messages
    172     ///
    173     ///\param m is the level of the messages output by the solver routines.
    174     void messageLevel(MessageLevel m);
    175 
    176158  };
    177159
  • lemon/concepts/digraph.h

    r529 r580  
    422422      Node oppositeNode(const Node&, const Arc&) const { return INVALID; }
    423423
    424       /// \brief Read write map of the nodes to type \c T.
    425       ///
    426       /// ReadWrite map of the nodes to type \c T.
    427       /// \sa Reference
     424      /// \brief Reference map of the nodes to type \c T.
     425      ///
     426      /// Reference map of the nodes to type \c T.
    428427      template<class T>
    429       class NodeMap : public ReadWriteMap< Node, T > {
     428      class NodeMap : public ReferenceMap<Node, T, T&, const T&> {
    430429      public:
    431430
     
    437436      private:
    438437        ///Copy constructor
    439         NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
     438        NodeMap(const NodeMap& nm) :
     439          ReferenceMap<Node, T, T&, const T&>(nm) { }
    440440        ///Assignment operator
    441441        template <typename CMap>
     
    446446      };
    447447
    448       /// \brief Read write map of the arcs to type \c T.
     448      /// \brief Reference map of the arcs to type \c T.
    449449      ///
    450450      /// Reference map of the arcs to type \c T.
    451       /// \sa Reference
    452451      template<class T>
    453       class ArcMap : public ReadWriteMap<Arc,T> {
     452      class ArcMap : public ReferenceMap<Arc, T, T&, const T&> {
    454453      public:
    455454
     
    460459      private:
    461460        ///Copy constructor
    462         ArcMap(const ArcMap& em) : ReadWriteMap<Arc,T>(em) { }
     461        ArcMap(const ArcMap& em) :
     462          ReferenceMap<Arc, T, T&, const T&>(em) { }
    463463        ///Assignment operator
    464464        template <typename CMap>
     
    472472      struct Constraints {
    473473        void constraints() {
     474          checkConcept<BaseDigraphComponent, _Digraph>();
    474475          checkConcept<IterableDigraphComponent<>, _Digraph>();
    475476          checkConcept<IDableDigraphComponent<>, _Digraph>();
  • lemon/concepts/graph.h

    r559 r580  
    498498      };
    499499
    500       /// \brief Read write map of the nodes to type \c T.
    501       ///
    502       /// ReadWrite map of the nodes to type \c T.
    503       /// \sa Reference
     500      /// \brief Reference map of the nodes to type \c T.
     501      ///
     502      /// Reference map of the nodes to type \c T.
    504503      template<class T>
    505       class NodeMap : public ReadWriteMap< Node, T >
     504      class NodeMap : public ReferenceMap<Node, T, T&, const T&>
    506505      {
    507506      public:
     
    514513      private:
    515514        ///Copy constructor
    516         NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
     515        NodeMap(const NodeMap& nm) :
     516          ReferenceMap<Node, T, T&, const T&>(nm) { }
    517517        ///Assignment operator
    518518        template <typename CMap>
     
    523523      };
    524524
    525       /// \brief Read write map of the directed arcs to type \c T.
    526       ///
    527       /// Reference map of the directed arcs to type \c T.
    528       /// \sa Reference
     525      /// \brief Reference map of the arcs to type \c T.
     526      ///
     527      /// Reference map of the arcs to type \c T.
    529528      template<class T>
    530       class ArcMap : public ReadWriteMap<Arc,T>
     529      class ArcMap : public ReferenceMap<Arc, T, T&, const T&>
    531530      {
    532531      public:
     
    538537      private:
    539538        ///Copy constructor
    540         ArcMap(const ArcMap& em) : ReadWriteMap<Arc,T>(em) { }
     539        ArcMap(const ArcMap& em) :
     540          ReferenceMap<Arc, T, T&, const T&>(em) { }
    541541        ///Assignment operator
    542542        template <typename CMap>
     
    547547      };
    548548
    549       /// Read write map of the edges to type \c T.
    550 
    551       /// Reference map of the arcs to type \c T.
    552       /// \sa Reference
     549      /// Reference map of the edges to type \c T.
     550
     551      /// Reference map of the edges to type \c T.
    553552      template<class T>
    554       class EdgeMap : public ReadWriteMap<Edge,T>
     553      class EdgeMap : public ReferenceMap<Edge, T, T&, const T&>
    555554      {
    556555      public:
     
    562561      private:
    563562        ///Copy constructor
    564         EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) {}
     563        EdgeMap(const EdgeMap& em) :
     564          ReferenceMap<Edge, T, T&, const T&>(em) {}
    565565        ///Assignment operator
    566566        template <typename CMap>
     
    749749      struct Constraints {
    750750        void constraints() {
     751          checkConcept<BaseGraphComponent, _Graph>();
    751752          checkConcept<IterableGraphComponent<>, _Graph>();
    752753          checkConcept<IDableGraphComponent<>, _Graph>();
  • lemon/concepts/graph_components.h

    r559 r584  
    3232  namespace concepts {
    3333
    34     /// \brief Skeleton class for graph Node and Arc types
    35     ///
    36     /// This class describes the interface of Node and Arc (and Edge
    37     /// in undirected graphs) subtypes of graph types.
     34    /// \brief Concept class for \c Node, \c Arc and \c Edge types.
     35    ///
     36    /// This class describes the concept of \c Node, \c Arc and \c Edge
     37    /// subtypes of digraph and graph types.
    3838    ///
    3939    /// \note This class is a template class so that we can use it to
    40     /// create graph skeleton classes. The reason for this is than Node
    41     /// and Arc types should \em not derive from the same base class.
    42     /// For Node you should instantiate it with character 'n' and for Arc
    43     /// with 'a'.
    44 
     40    /// create graph skeleton classes. The reason for this is that \c Node
     41    /// and \c Arc (or \c Edge) types should \e not derive from the same
     42    /// base class. For \c Node you should instantiate it with character
     43    /// \c 'n', for \c Arc with \c 'a' and for \c Edge with \c 'e'.
    4544#ifndef DOXYGEN
    4645    template <char sel = '0'>
     
    5049      /// \brief Default constructor.
    5150      ///
     51      /// Default constructor.
    5252      /// \warning The default constructor is not required to set
    5353      /// the item to some well-defined value. So you should consider it
    5454      /// as uninitialized.
    5555      GraphItem() {}
     56
    5657      /// \brief Copy constructor.
    5758      ///
    5859      /// Copy constructor.
    59       ///
    6060      GraphItem(const GraphItem &) {}
    61       /// \brief Invalid constructor \& conversion.
    62       ///
    63       /// This constructor initializes the item to be invalid.
     61
     62      /// \brief Constructor for conversion from \c INVALID.
     63      ///
     64      /// Constructor for conversion from \c INVALID.
     65      /// It initializes the item to be invalid.
    6466      /// \sa Invalid for more details.
    6567      GraphItem(Invalid) {}
    66       /// \brief Assign operator for nodes.
    67       ///
    68       /// The nodes are assignable.
    69       ///
    70       GraphItem& operator=(GraphItem const&) { return *this; }
     68
     69      /// \brief Assignment operator.
     70      ///
     71      /// Assignment operator for the item.
     72      GraphItem& operator=(const GraphItem&) { return *this; }
     73
    7174      /// \brief Equality operator.
    7275      ///
    73       /// Two iterators are equal if and only if they represents the
    74       /// same node in the graph or both are invalid.
    75       bool operator==(GraphItem) const { return false; }
     76      /// Equality operator.
     77      bool operator==(const GraphItem&) const { return false; }
     78
    7679      /// \brief Inequality operator.
    7780      ///
    78       /// \sa operator==(const Node& n)
    79       ///
    80       bool operator!=(GraphItem) const { return false; }
    81 
    82       /// \brief Artificial ordering operator.
    83       ///
    84       /// To allow the use of graph descriptors as key type in std::map or
    85       /// similar associative container we require this.
     81      /// Inequality operator.
     82      bool operator!=(const GraphItem&) const { return false; }
     83
     84      /// \brief Ordering operator.
     85      ///
     86      /// This operator defines an ordering of the items.
     87      /// It makes possible to use graph item types as key types in
     88      /// associative containers (e.g. \c std::map).
    8689      ///
    8790      /// \note This operator only have to define some strict ordering of
    8891      /// the items; this order has nothing to do with the iteration
    8992      /// ordering of the items.
    90       bool operator<(GraphItem) const { return false; }
     93      bool operator<(const GraphItem&) const { return false; }
    9194
    9295      template<typename _GraphItem>
     
    100103
    101104          bool b;
    102           //          b = (ia == ib) && (ia != ib) && (ia < ib);
    103105          b = (ia == ib) && (ia != ib);
    104106          b = (ia == INVALID) && (ib != INVALID);
     
    111113    };
    112114
    113     /// \brief An empty base directed graph class.
    114     ///
    115     /// This class provides the minimal set of features needed for a
    116     /// directed graph structure. All digraph concepts have to
    117     /// conform to this base directed graph. It just provides types
    118     /// for nodes and arcs and functions to get the source and the
    119     /// target of the arcs.
     115    /// \brief Base skeleton class for directed graphs.
     116    ///
     117    /// This class describes the base interface of directed graph types.
     118    /// All digraph %concepts have to conform to this class.
     119    /// It just provides types for nodes and arcs and functions
     120    /// to get the source and the target nodes of arcs.
    120121    class BaseDigraphComponent {
    121122    public:
     
    125126      /// \brief Node class of the digraph.
    126127      ///
    127       /// This class represents the Nodes of the digraph.
    128       ///
     128      /// This class represents the nodes of the digraph.
    129129      typedef GraphItem<'n'> Node;
    130130
    131131      /// \brief Arc class of the digraph.
    132132      ///
    133       /// This class represents the Arcs of the digraph.
    134       ///
    135       typedef GraphItem<'e'> Arc;
    136 
    137       /// \brief Gives back the target node of an arc.
    138       ///
    139       /// Gives back the target node of an arc.
    140       ///
    141       Node target(const Arc&) const { return INVALID;}
    142 
    143       /// \brief Gives back the source node of an arc.
    144       ///
    145       /// Gives back the source node of an arc.
    146       ///
    147       Node source(const Arc&) const { return INVALID;}
    148 
    149       /// \brief Gives back the opposite node on the given arc.
    150       ///
    151       /// Gives back the opposite node on the given arc.
     133      /// This class represents the arcs of the digraph.
     134      typedef GraphItem<'a'> Arc;
     135
     136      /// \brief Return the source node of an arc.
     137      ///
     138      /// This function returns the source node of an arc.
     139      Node source(const Arc&) const { return INVALID; }
     140
     141      /// \brief Return the target node of an arc.
     142      ///
     143      /// This function returns the target node of an arc.
     144      Node target(const Arc&) const { return INVALID; }
     145
     146      /// \brief Return the opposite node on the given arc.
     147      ///
     148      /// This function returns the opposite node on the given arc.
    152149      Node oppositeNode(const Node&, const Arc&) const {
    153150        return INVALID;
     
    175172    };
    176173
    177     /// \brief An empty base undirected graph class.
    178     ///
    179     /// This class provides the minimal set of features needed for an
    180     /// undirected graph structure. All undirected graph concepts have
    181     /// to conform to this base graph. It just provides types for
    182     /// nodes, arcs and edges and functions to get the
    183     /// source and the target of the arcs and edges,
    184     /// conversion from arcs to edges and function to get
    185     /// both direction of the edges.
     174    /// \brief Base skeleton class for undirected graphs.
     175    ///
     176    /// This class describes the base interface of undirected graph types.
     177    /// All graph %concepts have to conform to this class.
     178    /// It extends the interface of \ref BaseDigraphComponent with an
     179    /// \c Edge type and functions to get the end nodes of edges,
     180    /// to convert from arcs to edges and to get both direction of edges.
    186181    class BaseGraphComponent : public BaseDigraphComponent {
    187182    public:
    188183      typedef BaseDigraphComponent::Node Node;
    189184      typedef BaseDigraphComponent::Arc Arc;
    190       /// \brief Undirected arc class of the graph.
    191       ///
    192       /// This class represents the edges of the graph.
    193       /// The undirected graphs can be used as a directed graph which
    194       /// for each arc contains the opposite arc too so the graph is
    195       /// bidirected. The edge represents two opposite
    196       /// directed arcs.
    197       class Edge : public GraphItem<'u'> {
     185
     186      /// \brief Undirected edge class of the graph.
     187      ///
     188      /// This class represents the undirected edges of the graph.
     189      /// Undirected graphs can be used as directed graphs, each edge is
     190      /// represented by two opposite directed arcs.
     191      class Edge : public GraphItem<'e'> {
    198192      public:
    199         typedef GraphItem<'u'> Parent;
     193        typedef GraphItem<'e'> Parent;
     194
    200195        /// \brief Default constructor.
    201196        ///
     197        /// Default constructor.
    202198        /// \warning The default constructor is not required to set
    203199        /// the item to some well-defined value. So you should consider it
    204200        /// as uninitialized.
    205201        Edge() {}
     202
    206203        /// \brief Copy constructor.
    207204        ///
    208205        /// Copy constructor.
    209         ///
    210206        Edge(const Edge &) : Parent() {}
    211         /// \brief Invalid constructor \& conversion.
    212         ///
    213         /// This constructor initializes the item to be invalid.
     207
     208        /// \brief Constructor for conversion from \c INVALID.
     209        ///
     210        /// Constructor for conversion from \c INVALID.
     211        /// It initializes the item to be invalid.
    214212        /// \sa Invalid for more details.
    215213        Edge(Invalid) {}
    216         /// \brief Converter from arc to edge.
    217         ///
     214
     215        /// \brief Constructor for conversion from an arc.
     216        ///
     217        /// Constructor for conversion from an arc.
    218218        /// Besides the core graph item functionality each arc should
    219219        /// be convertible to the represented edge.
    220220        Edge(const Arc&) {}
    221         /// \brief Assign arc to edge.
    222         ///
     221
     222        /// \brief Assign an arc to an edge.
     223        ///
     224        /// This function assigns an arc to an edge.
    223225        /// Besides the core graph item functionality each arc should
    224226        /// be convertible to the represented edge.
     
    226228      };
    227229
    228       /// \brief Returns the direction of the arc.
     230      /// \brief Return one end node of an edge.
     231      ///
     232      /// This function returns one end node of an edge.
     233      Node u(const Edge&) const { return INVALID; }
     234
     235      /// \brief Return the other end node of an edge.
     236      ///
     237      /// This function returns the other end node of an edge.
     238      Node v(const Edge&) const { return INVALID; }
     239
     240      /// \brief Return a directed arc related to an edge.
     241      ///
     242      /// This function returns a directed arc from its direction and the
     243      /// represented edge.
     244      Arc direct(const Edge&, bool) const { return INVALID; }
     245
     246      /// \brief Return a directed arc related to an edge.
     247      ///
     248      /// This function returns a directed arc from its source node and the
     249      /// represented edge.
     250      Arc direct(const Edge&, const Node&) const { return INVALID; }
     251
     252      /// \brief Return the direction of the arc.
    229253      ///
    230254      /// Returns the direction of the arc. Each arc represents an
     
    233257      bool direction(const Arc&) const { return true; }
    234258
    235       /// \brief Returns the directed arc.
    236       ///
    237       /// Returns the directed arc from its direction and the
    238       /// represented edge.
    239       Arc direct(const Edge&, bool) const { return INVALID;}
    240 
    241       /// \brief Returns the directed arc.
    242       ///
    243       /// Returns the directed arc from its source and the
    244       /// represented edge.
    245       Arc direct(const Edge&, const Node&) const { return INVALID;}
    246 
    247       /// \brief Returns the opposite arc.
    248       ///
    249       /// Returns the opposite arc. It is the arc representing the
    250       /// same edge and has opposite direction.
    251       Arc oppositeArc(const Arc&) const { return INVALID;}
    252 
    253       /// \brief Gives back one ending of an edge.
    254       ///
    255       /// Gives back one ending of an edge.
    256       Node u(const Edge&) const { return INVALID;}
    257 
    258       /// \brief Gives back the other ending of an edge.
    259       ///
    260       /// Gives back the other ending of an edge.
    261       Node v(const Edge&) const { return INVALID;}
     259      /// \brief Return the opposite arc.
     260      ///
     261      /// This function returns the opposite arc, i.e. the arc representing
     262      /// the same edge and has opposite direction.
     263      Arc oppositeArc(const Arc&) const { return INVALID; }
    262264
    263265      template <typename _Graph>
     
    269271        void constraints() {
    270272          checkConcept<BaseDigraphComponent, _Graph>();
    271           checkConcept<GraphItem<'u'>, Edge>();
     273          checkConcept<GraphItem<'e'>, Edge>();
    272274          {
    273275            Node n;
     
    277279            n = graph.v(ue);
    278280            e = graph.direct(ue, true);
     281            e = graph.direct(ue, false);
    279282            e = graph.direct(ue, n);
    280283            e = graph.oppositeArc(e);
     
    290293    };
    291294
    292     /// \brief An empty idable base digraph class.
    293     ///
    294     /// This class provides beside the core digraph features
    295     /// core id functions for the digraph structure.
    296     /// The most of the base digraphs should conform to this concept.
    297     /// The id's are unique and immutable.
     295    /// \brief Skeleton class for \e idable directed graphs.
     296    ///
     297    /// This class describes the interface of \e idable directed graphs.
     298    /// It extends \ref BaseDigraphComponent with the core ID functions.
     299    /// The ids of the items must be unique and immutable.
     300    /// This concept is part of the Digraph concept.
    298301    template <typename BAS = BaseDigraphComponent>
    299302    class IDableDigraphComponent : public BAS {
     
    304307      typedef typename Base::Arc Arc;
    305308
    306       /// \brief Gives back an unique integer id for the Node.
    307       ///
    308       /// Gives back an unique integer id for the Node.
    309       ///
    310       int id(const Node&) const { return -1;}
    311 
    312       /// \brief Gives back the node by the unique id.
    313       ///
    314       /// Gives back the node by the unique id.
    315       /// If the digraph does not contain node with the given id
    316       /// then the result of the function is undetermined.
    317       Node nodeFromId(int) const { return INVALID;}
    318 
    319       /// \brief Gives back an unique integer id for the Arc.
    320       ///
    321       /// Gives back an unique integer id for the Arc.
    322       ///
    323       int id(const Arc&) const { return -1;}
    324 
    325       /// \brief Gives back the arc by the unique id.
    326       ///
    327       /// Gives back the arc by the unique id.
    328       /// If the digraph does not contain arc with the given id
    329       /// then the result of the function is undetermined.
    330       Arc arcFromId(int) const { return INVALID;}
    331 
    332       /// \brief Gives back an integer greater or equal to the maximum
    333       /// Node id.
    334       ///
    335       /// Gives back an integer greater or equal to the maximum Node
    336       /// id.
    337       int maxNodeId() const { return -1;}
    338 
    339       /// \brief Gives back an integer greater or equal to the maximum
    340       /// Arc id.
    341       ///
    342       /// Gives back an integer greater or equal to the maximum Arc
    343       /// id.
    344       int maxArcId() const { return -1;}
     309      /// \brief Return a unique integer id for the given node.
     310      ///
     311      /// This function returns a unique integer id for the given node.
     312      int id(const Node&) const { return -1; }
     313
     314      /// \brief Return the node by its unique id.
     315      ///
     316      /// This function returns the node by its unique id.
     317      /// If the digraph does not contain a node with the given id,
     318      /// then the result of the function is undefined.
     319      Node nodeFromId(int) const { return INVALID; }
     320
     321      /// \brief Return a unique integer id for the given arc.
     322      ///
     323      /// This function returns a unique integer id for the given arc.
     324      int id(const Arc&) const { return -1; }
     325
     326      /// \brief Return the arc by its unique id.
     327      ///
     328      /// This function returns the arc by its unique id.
     329      /// If the digraph does not contain an arc with the given id,
     330      /// then the result of the function is undefined.
     331      Arc arcFromId(int) const { return INVALID; }
     332
     333      /// \brief Return an integer greater or equal to the maximum
     334      /// node id.
     335      ///
     336      /// This function returns an integer greater or equal to the
     337      /// maximum node id.
     338      int maxNodeId() const { return -1; }
     339
     340      /// \brief Return an integer greater or equal to the maximum
     341      /// arc id.
     342      ///
     343      /// This function returns an integer greater or equal to the
     344      /// maximum arc id.
     345      int maxArcId() const { return -1; }
    345346
    346347      template <typename _Digraph>
     
    368369    };
    369370
    370     /// \brief An empty idable base undirected graph class.
    371     ///
    372     /// This class provides beside the core undirected graph features
    373     /// core id functions for the undirected graph structure.  The
    374     /// most of the base undirected graphs should conform to this
    375     /// concept.  The id's are unique and immutable.
     371    /// \brief Skeleton class for \e idable undirected graphs.
     372    ///
     373    /// This class describes the interface of \e idable undirected
     374    /// graphs. It extends \ref IDableDigraphComponent with the core ID
     375    /// functions of undirected graphs.
     376    /// The ids of the items must be unique and immutable.
     377    /// This concept is part of the Graph concept.
    376378    template <typename BAS = BaseGraphComponent>
    377379    class IDableGraphComponent : public IDableDigraphComponent<BAS> {
     
    383385      using IDableDigraphComponent<Base>::id;
    384386
    385       /// \brief Gives back an unique integer id for the Edge.
    386       ///
    387       /// Gives back an unique integer id for the Edge.
    388       ///
    389       int id(const Edge&) const { return -1;}
    390 
    391       /// \brief Gives back the edge by the unique id.
    392       ///
    393       /// Gives back the edge by the unique id.  If the
    394       /// graph does not contain arc with the given id then the
    395       /// result of the function is undetermined.
    396       Edge edgeFromId(int) const { return INVALID;}
    397 
    398       /// \brief Gives back an integer greater or equal to the maximum
    399       /// Edge id.
    400       ///
    401       /// Gives back an integer greater or equal to the maximum Edge
    402       /// id.
    403       int maxEdgeId() const { return -1;}
     387      /// \brief Return a unique integer id for the given edge.
     388      ///
     389      /// This function returns a unique integer id for the given edge.
     390      int id(const Edge&) const { return -1; }
     391
     392      /// \brief Return the edge by its unique id.
     393      ///
     394      /// This function returns the edge by its unique id.
     395      /// If the graph does not contain an edge with the given id,
     396      /// then the result of the function is undefined.
     397      Edge edgeFromId(int) const { return INVALID; }
     398
     399      /// \brief Return an integer greater or equal to the maximum
     400      /// edge id.
     401      ///
     402      /// This function returns an integer greater or equal to the
     403      /// maximum edge id.
     404      int maxEdgeId() const { return -1; }
    404405
    405406      template <typename _Graph>
     
    407408
    408409        void constraints() {
    409           checkConcept<Base, _Graph >();
    410410          checkConcept<IDableDigraphComponent<Base>, _Graph >();
    411411          typename _Graph::Edge edge;
     
    421421    };
    422422
    423     /// \brief Skeleton class for graph NodeIt and ArcIt
    424     ///
    425     /// Skeleton class for graph NodeIt and ArcIt.
    426     ///
     423    /// \brief Concept class for \c NodeIt, \c ArcIt and \c EdgeIt types.
     424    ///
     425    /// This class describes the concept of \c NodeIt, \c ArcIt and
     426    /// \c EdgeIt subtypes of digraph and graph types.
    427427    template <typename GR, typename Item>
    428428    class GraphItemIt : public Item {
     
    430430      /// \brief Default constructor.
    431431      ///
    432       /// @warning The default constructor sets the iterator
    433       /// to an undefined value.
     432      /// Default constructor.
     433      /// \warning The default constructor is not required to set
     434      /// the iterator to some well-defined value. So you should consider it
     435      /// as uninitialized.
    434436      GraphItemIt() {}
     437
    435438      /// \brief Copy constructor.
    436439      ///
    437440      /// Copy constructor.
    438       ///
    439       GraphItemIt(const GraphItemIt& ) {}
    440       /// \brief Sets the iterator to the first item.
    441       ///
    442       /// Sets the iterator to the first item of \c the graph.
    443       ///
     441      GraphItemIt(const GraphItemIt& it) : Item(it) {}
     442
     443      /// \brief Constructor that sets the iterator to the first item.
     444      ///
     445      /// Constructor that sets the iterator to the first item.
    444446      explicit GraphItemIt(const GR&) {}
    445       /// \brief Invalid constructor \& conversion.
    446       ///
    447       /// This constructor initializes the item to be invalid.
     447
     448      /// \brief Constructor for conversion from \c INVALID.
     449      ///
     450      /// Constructor for conversion from \c INVALID.
     451      /// It initializes the iterator to be invalid.
    448452      /// \sa Invalid for more details.
    449453      GraphItemIt(Invalid) {}
    450       /// \brief Assign operator for items.
    451       ///
    452       /// The items are assignable.
    453       ///
     454
     455      /// \brief Assignment operator.
     456      ///
     457      /// Assignment operator for the iterator.
    454458      GraphItemIt& operator=(const GraphItemIt&) { return *this; }
    455       /// \brief Next item.
    456       ///
    457       /// Assign the iterator to the next item.
    458       ///
     459
     460      /// \brief Increment the iterator.
     461      ///
     462      /// This operator increments the iterator, i.e. assigns it to the
     463      /// next item.
    459464      GraphItemIt& operator++() { return *this; }
     465 
    460466      /// \brief Equality operator
    461467      ///
     468      /// Equality operator.
    462469      /// Two iterators are equal if and only if they point to the
    463470      /// same object or both are invalid.
    464471      bool operator==(const GraphItemIt&) const { return true;}
     472
    465473      /// \brief Inequality operator
    466474      ///
    467       /// \sa operator==(Node n)
    468       ///
     475      /// Inequality operator.
     476      /// Two iterators are equal if and only if they point to the
     477      /// same object or both are invalid.
    469478      bool operator!=(const GraphItemIt&) const { return true;}
    470479
     
    472481      struct Constraints {
    473482        void constraints() {
     483          checkConcept<GraphItem<>, _GraphItemIt>();
    474484          _GraphItemIt it1(g);
    475485          _GraphItemIt it2;
     486          _GraphItemIt it3 = it1;
     487          _GraphItemIt it4 = INVALID;
    476488
    477489          it2 = ++it1;
     
    482494          bi = it2;
    483495        }
    484         GR& g;
    485       };
    486     };
    487 
    488     /// \brief Skeleton class for graph InArcIt and OutArcIt
    489     ///
    490     /// \note Because InArcIt and OutArcIt may not inherit from the same
    491     /// base class, the \c sel is a additional template parameter (selector).
    492     /// For InArcIt you should instantiate it with character 'i' and for
    493     /// OutArcIt with 'o'.
     496        const GR& g;
     497      };
     498    };
     499
     500    /// \brief Concept class for \c InArcIt, \c OutArcIt and
     501    /// \c IncEdgeIt types.
     502    ///
     503    /// This class describes the concept of \c InArcIt, \c OutArcIt
     504    /// and \c IncEdgeIt subtypes of digraph and graph types.
     505    ///
     506    /// \note Since these iterator classes do not inherit from the same
     507    /// base class, there is an additional template parameter (selector)
     508    /// \c sel. For \c InArcIt you should instantiate it with character
     509    /// \c 'i', for \c OutArcIt with \c 'o' and for \c IncEdgeIt with \c 'e'.
    494510    template <typename GR,
    495511              typename Item = typename GR::Arc,
     
    500516      /// \brief Default constructor.
    501517      ///
    502       /// @warning The default constructor sets the iterator
    503       /// to an undefined value.
     518      /// Default constructor.
     519      /// \warning The default constructor is not required to set
     520      /// the iterator to some well-defined value. So you should consider it
     521      /// as uninitialized.
    504522      GraphIncIt() {}
     523
    505524      /// \brief Copy constructor.
    506525      ///
    507526      /// Copy constructor.
    508       ///
    509       GraphIncIt(GraphIncIt const& gi) : Item(gi) {}
    510       /// \brief Sets the iterator to the first arc incoming into or outgoing
    511       /// from the node.
    512       ///
    513       /// Sets the iterator to the first arc incoming into or outgoing
    514       /// from the node.
    515       ///
     527      GraphIncIt(const GraphIncIt& it) : Item(it) {}
     528
     529      /// \brief Constructor that sets the iterator to the first
     530      /// incoming or outgoing arc.
     531      ///
     532      /// Constructor that sets the iterator to the first arc
     533      /// incoming to or outgoing from the given node.
    516534      explicit GraphIncIt(const GR&, const Base&) {}
    517       /// \brief Invalid constructor \& conversion.
    518       ///
    519       /// This constructor initializes the item to be invalid.
     535
     536      /// \brief Constructor for conversion from \c INVALID.
     537      ///
     538      /// Constructor for conversion from \c INVALID.
     539      /// It initializes the iterator to be invalid.
    520540      /// \sa Invalid for more details.
    521541      GraphIncIt(Invalid) {}
    522       /// \brief Assign operator for iterators.
    523       ///
    524       /// The iterators are assignable.
    525       ///
    526       GraphIncIt& operator=(GraphIncIt const&) { return *this; }
    527       /// \brief Next item.
    528       ///
    529       /// Assign the iterator to the next item.
    530       ///
     542
     543      /// \brief Assignment operator.
     544      ///
     545      /// Assignment operator for the iterator.
     546      GraphIncIt& operator=(const GraphIncIt&) { return *this; }
     547
     548      /// \brief Increment the iterator.
     549      ///
     550      /// This operator increments the iterator, i.e. assigns it to the
     551      /// next arc incoming to or outgoing from the given node.
    531552      GraphIncIt& operator++() { return *this; }
    532553
    533554      /// \brief Equality operator
    534555      ///
     556      /// Equality operator.
    535557      /// Two iterators are equal if and only if they point to the
    536558      /// same object or both are invalid.
     
    539561      /// \brief Inequality operator
    540562      ///
    541       /// \sa operator==(Node n)
    542       ///
     563      /// Inequality operator.
     564      /// Two iterators are equal if and only if they point to the
     565      /// same object or both are invalid.
    543566      bool operator!=(const GraphIncIt&) const { return true;}
    544567
     
    549572          _GraphIncIt it1(graph, node);
    550573          _GraphIncIt it2;
     574          _GraphIncIt it3 = it1;
     575          _GraphIncIt it4 = INVALID;
    551576
    552577          it2 = ++it1;
     
    555580          Item e = it1;
    556581          e = it2;
    557 
    558         }
    559 
    560         Item arc;
    561         Base node;
    562         GR graph;
    563         _GraphIncIt it;
    564       };
    565     };
    566 
    567 
    568     /// \brief An empty iterable digraph class.
    569     ///
    570     /// This class provides beside the core digraph features
    571     /// iterator based iterable interface for the digraph structure.
     582        }
     583        const Base& node;
     584        const GR& graph;
     585      };
     586    };
     587
     588    /// \brief Skeleton class for iterable directed graphs.
     589    ///
     590    /// This class describes the interface of iterable directed
     591    /// graphs. It extends \ref BaseDigraphComponent with the core
     592    /// iterable interface.
    572593    /// This concept is part of the Digraph concept.
    573594    template <typename BAS = BaseDigraphComponent>
     
    582603      typedef IterableDigraphComponent Digraph;
    583604
    584       /// \name Base iteration
    585       ///
    586       /// This interface provides functions for iteration on digraph items
     605      /// \name Base Iteration
     606      ///
     607      /// This interface provides functions for iteration on digraph items.
    587608      ///
    588609      /// @{
    589610
    590       /// \brief Gives back the first node in the iterating order.
    591       ///
    592       /// Gives back the first node in the iterating order.
    593       ///
     611      /// \brief Return the first node.
     612      ///
     613      /// This function gives back the first node in the iteration order.
    594614      void first(Node&) const {}
    595615
    596       /// \brief Gives back the next node in the iterating order.
    597       ///
    598       /// Gives back the next node in the iterating order.
    599       ///
     616      /// \brief Return the next node.
     617      ///
     618      /// This function gives back the next node in the iteration order.
    600619      void next(Node&) const {}
    601620
    602       /// \brief Gives back the first arc in the iterating order.
    603       ///
    604       /// Gives back the first arc in the iterating order.
    605       ///
     621      /// \brief Return the first arc.
     622      ///
     623      /// This function gives back the first arc in the iteration order.
    606624      void first(Arc&) const {}
    607625
    608       /// \brief Gives back the next arc in the iterating order.
    609       ///
    610       /// Gives back the next arc in the iterating order.
    611       ///
     626      /// \brief Return the next arc.
     627      ///
     628      /// This function gives back the next arc in the iteration order.
    612629      void next(Arc&) const {}
    613630
    614 
    615       /// \brief Gives back the first of the arcs point to the given
    616       /// node.
    617       ///
    618       /// Gives back the first of the arcs point to the given node.
    619       ///
     631      /// \brief Return the first arc incomming to the given node.
     632      ///
     633      /// This function gives back the first arc incomming to the
     634      /// given node.
    620635      void firstIn(Arc&, const Node&) const {}
    621636
    622       /// \brief Gives back the next of the arcs points to the given
    623       /// node.
    624       ///
    625       /// Gives back the next of the arcs points to the given node.
    626       ///
     637      /// \brief Return the next arc incomming to the given node.
     638      ///
     639      /// This function gives back the next arc incomming to the
     640      /// given node.
    627641      void nextIn(Arc&) const {}
    628642
    629       /// \brief Gives back the first of the arcs start from the
     643      /// \brief Return the first arc outgoing form the given node.
     644      ///
     645      /// This function gives back the first arc outgoing form the
    630646      /// given node.
    631       ///
    632       /// Gives back the first of the arcs start from the given node.
    633       ///
    634647      void firstOut(Arc&, const Node&) const {}
    635648
    636       /// \brief Gives back the next of the arcs start from the given
    637       /// node.
    638       ///
    639       /// Gives back the next of the arcs start from the given node.
    640       ///
     649      /// \brief Return the next arc outgoing form the given node.
     650      ///
     651      /// This function gives back the next arc outgoing form the
     652      /// given node.
    641653      void nextOut(Arc&) const {}
    642654
    643655      /// @}
    644656
    645       /// \name Class based iteration
    646       ///
    647       /// This interface provides functions for iteration on digraph items
     657      /// \name Class Based Iteration
     658      ///
     659      /// This interface provides iterator classes for digraph items.
    648660      ///
    649661      /// @{
     
    655667      typedef GraphItemIt<Digraph, Node> NodeIt;
    656668
    657       /// \brief This iterator goes through each node.
    658       ///
    659       /// This iterator goes through each node.
     669      /// \brief This iterator goes through each arc.
     670      ///
     671      /// This iterator goes through each arc.
    660672      ///
    661673      typedef GraphItemIt<Digraph, Arc> ArcIt;
     
    663675      /// \brief This iterator goes trough the incoming arcs of a node.
    664676      ///
    665       /// This iterator goes trough the \e inccoming arcs of a certain node
     677      /// This iterator goes trough the \e incoming arcs of a certain node
    666678      /// of a digraph.
    667679      typedef GraphIncIt<Digraph, Arc, Node, 'i'> InArcIt;
     
    675687      /// \brief The base node of the iterator.
    676688      ///
    677       /// Gives back the base node of the iterator.
    678       /// It is always the target of the pointed arc.
     689      /// This function gives back the base node of the iterator.
     690      /// It is always the target node of the pointed arc.
    679691      Node baseNode(const InArcIt&) const { return INVALID; }
    680692
    681693      /// \brief The running node of the iterator.
    682694      ///
    683       /// Gives back the running node of the iterator.
    684       /// It is always the source of the pointed arc.
     695      /// This function gives back the running node of the iterator.
     696      /// It is always the source node of the pointed arc.
    685697      Node runningNode(const InArcIt&) const { return INVALID; }
    686698
    687699      /// \brief The base node of the iterator.
    688700      ///
    689       /// Gives back the base node of the iterator.
    690       /// It is always the source of the pointed arc.
     701      /// This function gives back the base node of the iterator.
     702      /// It is always the source node of the pointed arc.
    691703      Node baseNode(const OutArcIt&) const { return INVALID; }
    692704
    693705      /// \brief The running node of the iterator.
    694706      ///
    695       /// Gives back the running node of the iterator.
    696       /// It is always the target of the pointed arc.
     707      /// This function gives back the running node of the iterator.
     708      /// It is always the target node of the pointed arc.
    697709      Node runningNode(const OutArcIt&) const { return INVALID; }
    698710
     
    736748
    737749            typename _Digraph::Node n;
    738             typename _Digraph::InArcIt ieit(INVALID);
    739             typename _Digraph::OutArcIt oeit(INVALID);
    740             n = digraph.baseNode(ieit);
    741             n = digraph.runningNode(ieit);
    742             n = digraph.baseNode(oeit);
    743             n = digraph.runningNode(oeit);
     750            const typename _Digraph::InArcIt iait(INVALID);
     751            const typename _Digraph::OutArcIt oait(INVALID);
     752            n = digraph.baseNode(iait);
     753            n = digraph.runningNode(iait);
     754            n = digraph.baseNode(oait);
     755            n = digraph.runningNode(oait);
    744756            ignore_unused_variable_warning(n);
    745757          }
     
    747759
    748760        const _Digraph& digraph;
    749 
    750       };
    751     };
    752 
    753     /// \brief An empty iterable undirected graph class.
    754     ///
    755     /// This class provides beside the core graph features iterator
    756     /// based iterable interface for the undirected graph structure.
     761      };
     762    };
     763
     764    /// \brief Skeleton class for iterable undirected graphs.
     765    ///
     766    /// This class describes the interface of iterable undirected
     767    /// graphs. It extends \ref IterableDigraphComponent with the core
     768    /// iterable interface of undirected graphs.
    757769    /// This concept is part of the Graph concept.
    758770    template <typename BAS = BaseGraphComponent>
     
    768780      typedef IterableGraphComponent Graph;
    769781
    770       /// \name Base iteration
    771       ///
    772       /// This interface provides functions for iteration on graph items
     782      /// \name Base Iteration
     783      ///
     784      /// This interface provides functions for iteration on edges.
     785      ///
    773786      /// @{
    774787
     
    776789      using IterableDigraphComponent<Base>::next;
    777790
    778       /// \brief Gives back the first edge in the iterating
    779       /// order.
    780       ///
    781       /// Gives back the first edge in the iterating order.
    782       ///
     791      /// \brief Return the first edge.
     792      ///
     793      /// This function gives back the first edge in the iteration order.
    783794      void first(Edge&) const {}
    784795
    785       /// \brief Gives back the next edge in the iterating
    786       /// order.
    787       ///
    788       /// Gives back the next edge in the iterating order.
    789       ///
     796      /// \brief Return the next edge.
     797      ///
     798      /// This function gives back the next edge in the iteration order.
    790799      void next(Edge&) const {}
    791800
    792 
    793       /// \brief Gives back the first of the edges from the
     801      /// \brief Return the first edge incident to the given node.
     802      ///
     803      /// This function gives back the first edge incident to the given
     804      /// node. The bool parameter gives back the direction for which the
     805      /// source node of the directed arc representing the edge is the
    794806      /// given node.
    795       ///
    796       /// Gives back the first of the edges from the given
    797       /// node. The bool parameter gives back that direction which
    798       /// gives a good direction of the edge so the source of the
    799       /// directed arc is the given node.
    800807      void firstInc(Edge&, bool&, const Node&) const {}
    801808
     
    803810      /// given node.
    804811      ///
    805       /// Gives back the next of the edges from the given
    806       /// node. The bool parameter should be used as the \c firstInc()
    807       /// use it.
     812      /// This function gives back the next edge incident to the given
     813      /// node. The bool parameter should be used as \c firstInc() use it.
    808814      void nextInc(Edge&, bool&) const {}
    809815
     
    813819      /// @}
    814820
    815       /// \name Class based iteration
    816       ///
    817       /// This interface provides functions for iteration on graph items
     821      /// \name Class Based Iteration
     822      ///
     823      /// This interface provides iterator classes for edges.
    818824      ///
    819825      /// @{
    820826
    821       /// \brief This iterator goes through each node.
    822       ///
    823       /// This iterator goes through each node.
     827      /// \brief This iterator goes through each edge.
     828      ///
     829      /// This iterator goes through each edge.
    824830      typedef GraphItemIt<Graph, Edge> EdgeIt;
    825       /// \brief This iterator goes trough the incident arcs of a
     831
     832      /// \brief This iterator goes trough the incident edges of a
    826833      /// node.
    827834      ///
    828       /// This iterator goes trough the incident arcs of a certain
     835      /// This iterator goes trough the incident edges of a certain
    829836      /// node of a graph.
    830       typedef GraphIncIt<Graph, Edge, Node, 'u'> IncEdgeIt;
     837      typedef GraphIncIt<Graph, Edge, Node, 'e'> IncEdgeIt;
     838
    831839      /// \brief The base node of the iterator.
    832840      ///
    833       /// Gives back the base node of the iterator.
     841      /// This function gives back the base node of the iterator.
    834842      Node baseNode(const IncEdgeIt&) const { return INVALID; }
    835843
    836844      /// \brief The running node of the iterator.
    837845      ///
    838       /// Gives back the running node of the iterator.
     846      /// This function gives back the running node of the iterator.
    839847      Node runningNode(const IncEdgeIt&) const { return INVALID; }
    840848
     
    865873              typename _Graph::EdgeIt >();
    866874            checkConcept<GraphIncIt<_Graph, typename _Graph::Edge,
    867               typename _Graph::Node, 'u'>, typename _Graph::IncEdgeIt>();
     875              typename _Graph::Node, 'e'>, typename _Graph::IncEdgeIt>();
    868876
    869877            typename _Graph::Node n;
    870             typename _Graph::IncEdgeIt ueit(INVALID);
    871             n = graph.baseNode(ueit);
    872             n = graph.runningNode(ueit);
     878            const typename _Graph::IncEdgeIt ieit(INVALID);
     879            n = graph.baseNode(ieit);
     880            n = graph.runningNode(ieit);
    873881          }
    874882        }
     
    878886    };
    879887
    880     /// \brief An empty alteration notifier digraph class.
    881     ///
    882     /// This class provides beside the core digraph features alteration
    883     /// notifier interface for the digraph structure.  This implements
     888    /// \brief Skeleton class for alterable directed graphs.
     889    ///
     890    /// This class describes the interface of alterable directed
     891    /// graphs. It extends \ref BaseDigraphComponent with the alteration
     892    /// notifier interface. It implements
    884893    /// an observer-notifier pattern for each digraph item. More
    885894    /// obsevers can be registered into the notifier and whenever an
    886     /// alteration occured in the digraph all the observers will
     895    /// alteration occured in the digraph all the observers will be
    887896    /// notified about it.
    888897    template <typename BAS = BaseDigraphComponent>
     
    895904
    896905
    897       /// The node observer registry.
     906      /// Node alteration notifier class.
    898907      typedef AlterationNotifier<AlterableDigraphComponent, Node>
    899908      NodeNotifier;
    900       /// The arc observer registry.
     909      /// Arc alteration notifier class.
    901910      typedef AlterationNotifier<AlterableDigraphComponent, Arc>
    902911      ArcNotifier;
    903912
    904       /// \brief Gives back the node alteration notifier.
    905       ///
    906       /// Gives back the node alteration notifier.
     913      /// \brief Return the node alteration notifier.
     914      ///
     915      /// This function gives back the node alteration notifier.
    907916      NodeNotifier& notifier(Node) const {
    908         return NodeNotifier();
     917         return NodeNotifier();
    909918      }
    910919
    911       /// \brief Gives back the arc alteration notifier.
    912       ///
    913       /// Gives back the arc alteration notifier.
     920      /// \brief Return the arc alteration notifier.
     921      ///
     922      /// This function gives back the arc alteration notifier.
    914923      ArcNotifier& notifier(Arc) const {
    915924        return ArcNotifier();
     
    931940
    932941        const _Digraph& digraph;
    933 
    934       };
    935 
    936     };
    937 
    938     /// \brief An empty alteration notifier undirected graph class.
    939     ///
    940     /// This class provides beside the core graph features alteration
    941     /// notifier interface for the graph structure.  This implements
    942     /// an observer-notifier pattern for each graph item. More
     942      };
     943    };
     944
     945    /// \brief Skeleton class for alterable undirected graphs.
     946    ///
     947    /// This class describes the interface of alterable undirected
     948    /// graphs. It extends \ref AlterableDigraphComponent with the alteration
     949    /// notifier interface of undirected graphs. It implements
     950    /// an observer-notifier pattern for the edges. More
    943951    /// obsevers can be registered into the notifier and whenever an
    944     /// alteration occured in the graph all the observers will
     952    /// alteration occured in the graph all the observers will be
    945953    /// notified about it.
    946954    template <typename BAS = BaseGraphComponent>
     
    952960
    953961
    954       /// The arc observer registry.
     962      /// Edge alteration notifier class.
    955963      typedef AlterationNotifier<AlterableGraphComponent, Edge>
    956964      EdgeNotifier;
    957965
    958       /// \brief Gives back the arc alteration notifier.
    959       ///
    960       /// Gives back the arc alteration notifier.
     966      /// \brief Return the edge alteration notifier.
     967      ///
     968      /// This function gives back the edge alteration notifier.
    961969      EdgeNotifier& notifier(Edge) const {
    962970        return EdgeNotifier();
     
    966974      struct Constraints {
    967975        void constraints() {
    968           checkConcept<AlterableGraphComponent<Base>, _Graph>();
     976          checkConcept<AlterableDigraphComponent<Base>, _Graph>();
    969977          typename _Graph::EdgeNotifier& uen
    970978            = graph.notifier(typename _Graph::Edge());
     
    976984    };
    977985
    978     /// \brief Class describing the concept of graph maps
    979     ///
    980     /// This class describes the common interface of the graph maps
    981     /// (NodeMap, ArcMap), that is maps that can be used to
    982     /// associate data to graph descriptors (nodes or arcs).
     986    /// \brief Concept class for standard graph maps.
     987    ///
     988    /// This class describes the concept of standard graph maps, i.e.
     989    /// the \c NodeMap, \c ArcMap and \c EdgeMap subtypes of digraph and
     990    /// graph types, which can be used for associating data to graph items.
     991    /// The standard graph maps must conform to the ReferenceMap concept.
    983992    template <typename GR, typename K, typename V>
    984     class GraphMap : public ReadWriteMap<K, V> {
     993    class GraphMap : public ReferenceMap<K, V, V&, const V&> {
    985994    public:
    986995
     
    9931002      /// The value type of the map.
    9941003      typedef V Value;
     1004      /// The reference type of the map.
     1005      typedef Value& Reference;
     1006      /// The const reference type of the map.
     1007      typedef const Value& ConstReference;
     1008
     1009      // The reference map tag.
     1010      typedef True ReferenceMapTag;
    9951011
    9961012      /// \brief Construct a new map.
     
    10001016      /// \brief Construct a new map with default value.
    10011017      ///
    1002       /// Construct a new map for the graph and initalise the values.
     1018      /// Construct a new map for the graph and initalize the values.
    10031019      GraphMap(const Graph&, const Value&) {}
    10041020
     
    10091025      GraphMap(const GraphMap&) : Parent() {}
    10101026
    1011       /// \brief Assign operator.
    1012       ///
    1013       /// Assign operator. It does not mofify the underlying graph,
     1027      /// \brief Assignment operator.
     1028      ///
     1029      /// Assignment operator. It does not mofify the underlying graph,
    10141030      /// it just iterates on the current item set and set the  map
    10151031      /// with the value returned by the assigned map.
     
    10241040      struct Constraints {
    10251041        void constraints() {
    1026           checkConcept<ReadWriteMap<Key, Value>, _Map >();
    1027           // Construction with a graph parameter
    1028           _Map a(g);
    1029           // Constructor with a graph and a default value parameter
    1030           _Map a2(g,t);
    1031           // Copy constructor.
    1032           // _Map b(c);
    1033 
     1042          checkConcept
     1043            <ReferenceMap<Key, Value, Value&, const Value&>, _Map>();
     1044          _Map m1(g);
     1045          _Map m2(g,t);
     1046         
     1047          // Copy constructor
     1048          // _Map m3(m);
     1049
     1050          // Assignment operator
    10341051          // ReadMap<Key, Value> cmap;
    1035           // b = cmap;
    1036 
    1037           ignore_unused_variable_warning(a);
    1038           ignore_unused_variable_warning(a2);
    1039           // ignore_unused_variable_warning(b);
    1040         }
    1041 
    1042         const _Map &c;
     1052          // m3 = cmap;
     1053
     1054          ignore_unused_variable_warning(m1);
     1055          ignore_unused_variable_warning(m2);
     1056          // ignore_unused_variable_warning(m3);
     1057        }
     1058
     1059        const _Map &m;
    10431060        const Graph &g;
    10441061        const typename GraphMap::Value &t;
     
    10471064    };
    10481065
    1049     /// \brief An empty mappable digraph class.
    1050     ///
    1051     /// This class provides beside the core digraph features
    1052     /// map interface for the digraph structure.
     1066    /// \brief Skeleton class for mappable directed graphs.
     1067    ///
     1068    /// This class describes the interface of mappable directed graphs.
     1069    /// It extends \ref BaseDigraphComponent with the standard digraph
     1070    /// map classes, namely \c NodeMap and \c ArcMap.
    10531071    /// This concept is part of the Digraph concept.
    10541072    template <typename BAS = BaseDigraphComponent>
     
    10621080      typedef MappableDigraphComponent Digraph;
    10631081
    1064       /// \brief ReadWrite map of the nodes.
    1065       ///
    1066       /// ReadWrite map of the nodes.
    1067       ///
     1082      /// \brief Standard graph map for the nodes.
     1083      ///
     1084      /// Standard graph map for the nodes.
     1085      /// It conforms to the ReferenceMap concept.
    10681086      template <typename V>
    1069       class NodeMap : public GraphMap<Digraph, Node, V> {
     1087      class NodeMap : public GraphMap<MappableDigraphComponent, Node, V> {
    10701088      public:
    10711089        typedef GraphMap<MappableDigraphComponent, Node, V> Parent;
     
    10791097        /// \brief Construct a new map with default value.
    10801098        ///
    1081         /// Construct a new map for the digraph and initalise the values.
     1099        /// Construct a new map for the digraph and initalize the values.
    10821100        NodeMap(const MappableDigraphComponent& digraph, const V& value)
    10831101          : Parent(digraph, value) {}
     
    10891107        NodeMap(const NodeMap& nm) : Parent(nm) {}
    10901108
    1091         /// \brief Assign operator.
    1092         ///
    1093         /// Assign operator.
     1109        /// \brief Assignment operator.
     1110        ///
     1111        /// Assignment operator.
    10941112        template <typename CMap>
    10951113        NodeMap& operator=(const CMap&) {
     
    11001118      };
    11011119
    1102       /// \brief ReadWrite map of the arcs.
    1103       ///
    1104       /// ReadWrite map of the arcs.
    1105       ///
     1120      /// \brief Standard graph map for the arcs.
     1121      ///
     1122      /// Standard graph map for the arcs.
     1123      /// It conforms to the ReferenceMap concept.
    11061124      template <typename V>
    1107       class ArcMap : public GraphMap<Digraph, Arc, V> {
     1125      class ArcMap : public GraphMap<MappableDigraphComponent, Arc, V> {
    11081126      public:
    11091127        typedef GraphMap<MappableDigraphComponent, Arc, V> Parent;
     
    11171135        /// \brief Construct a new map with default value.
    11181136        ///
    1119         /// Construct a new map for the digraph and initalise the values.
     1137        /// Construct a new map for the digraph and initalize the values.
    11201138        ArcMap(const MappableDigraphComponent& digraph, const V& value)
    11211139          : Parent(digraph, value) {}
     
    11271145        ArcMap(const ArcMap& nm) : Parent(nm) {}
    11281146
    1129         /// \brief Assign operator.
    1130         ///
    1131         /// Assign operator.
     1147        /// \brief Assignment operator.
     1148        ///
     1149        /// Assignment operator.
    11321150        template <typename CMap>
    11331151        ArcMap& operator=(const CMap&) {
     
    11791197        }
    11801198
    1181         _Digraph& digraph;
    1182       };
    1183     };
    1184 
    1185     /// \brief An empty mappable base bipartite graph class.
    1186     ///
    1187     /// This class provides beside the core graph features
    1188     /// map interface for the graph structure.
     1199        const _Digraph& digraph;
     1200      };
     1201    };
     1202
     1203    /// \brief Skeleton class for mappable undirected graphs.
     1204    ///
     1205    /// This class describes the interface of mappable undirected graphs.
     1206    /// It extends \ref MappableDigraphComponent with the standard graph
     1207    /// map class for edges (\c EdgeMap).
    11891208    /// This concept is part of the Graph concept.
    11901209    template <typename BAS = BaseGraphComponent>
     
    11971216      typedef MappableGraphComponent Graph;
    11981217
    1199       /// \brief ReadWrite map of the edges.
    1200       ///
    1201       /// ReadWrite map of the edges.
    1202       ///
     1218      /// \brief Standard graph map for the edges.
     1219      ///
     1220      /// Standard graph map for the edges.
     1221      /// It conforms to the ReferenceMap concept.
    12031222      template <typename V>
    1204       class EdgeMap : public GraphMap<Graph, Edge, V> {
     1223      class EdgeMap : public GraphMap<MappableGraphComponent, Edge, V> {
    12051224      public:
    12061225        typedef GraphMap<MappableGraphComponent, Edge, V> Parent;
     
    12141233        /// \brief Construct a new map with default value.
    12151234        ///
    1216         /// Construct a new map for the graph and initalise the values.
     1235        /// Construct a new map for the graph and initalize the values.
    12171236        EdgeMap(const MappableGraphComponent& graph, const V& value)
    12181237          : Parent(graph, value) {}
     
    12241243        EdgeMap(const EdgeMap& nm) : Parent(nm) {}
    12251244
    1226         /// \brief Assign operator.
    1227         ///
    1228         /// Assign operator.
     1245        /// \brief Assignment operator.
     1246        ///
     1247        /// Assignment operator.
    12291248        template <typename CMap>
    12301249        EdgeMap& operator=(const CMap&) {
     
    12461265
    12471266        void constraints() {
    1248           checkConcept<MappableGraphComponent<Base>, _Graph>();
     1267          checkConcept<MappableDigraphComponent<Base>, _Graph>();
    12491268
    12501269          { // int map test
     
    12631282        }
    12641283
    1265         _Graph& graph;
    1266       };
    1267     };
    1268 
    1269     /// \brief An empty extendable digraph class.
    1270     ///
    1271     /// This class provides beside the core digraph features digraph
    1272     /// extendable interface for the digraph structure.  The main
    1273     /// difference between the base and this interface is that the
    1274     /// digraph alterations should handled already on this level.
     1284        const _Graph& graph;
     1285      };
     1286    };
     1287
     1288    /// \brief Skeleton class for extendable directed graphs.
     1289    ///
     1290    /// This class describes the interface of extendable directed graphs.
     1291    /// It extends \ref BaseDigraphComponent with functions for adding
     1292    /// nodes and arcs to the digraph.
     1293    /// This concept requires \ref AlterableDigraphComponent.
    12751294    template <typename BAS = BaseDigraphComponent>
    12761295    class ExtendableDigraphComponent : public BAS {
     
    12811300      typedef typename Base::Arc Arc;
    12821301
    1283       /// \brief Adds a new node to the digraph.
    1284       ///
    1285       /// Adds a new node to the digraph.
    1286       ///
     1302      /// \brief Add a new node to the digraph.
     1303      ///
     1304      /// This function adds a new node to the digraph.
    12871305      Node addNode() {
    12881306        return INVALID;
    12891307      }
    12901308
    1291       /// \brief Adds a new arc connects the given two nodes.
    1292       ///
    1293       /// Adds a new arc connects the the given two nodes.
     1309      /// \brief Add a new arc connecting the given two nodes.
     1310      ///
     1311      /// This function adds a new arc connecting the given two nodes
     1312      /// of the digraph.
    12941313      Arc addArc(const Node&, const Node&) {
    12951314        return INVALID;
     
    13111330    };
    13121331
    1313     /// \brief An empty extendable base undirected graph class.
    1314     ///
    1315     /// This class provides beside the core undirected graph features
    1316     /// core undircted graph extend interface for the graph structure.
    1317     /// The main difference between the base and this interface is
    1318     /// that the graph alterations should handled already on this
    1319     /// level.
     1332    /// \brief Skeleton class for extendable undirected graphs.
     1333    ///
     1334    /// This class describes the interface of extendable undirected graphs.
     1335    /// It extends \ref BaseGraphComponent with functions for adding
     1336    /// nodes and edges to the graph.
     1337    /// This concept requires \ref AlterableGraphComponent.
    13201338    template <typename BAS = BaseGraphComponent>
    13211339    class ExtendableGraphComponent : public BAS {
     
    13261344      typedef typename Base::Edge Edge;
    13271345
    1328       /// \brief Adds a new node to the graph.
    1329       ///
    1330       /// Adds a new node to the graph.
    1331       ///
     1346      /// \brief Add a new node to the digraph.
     1347      ///
     1348      /// This function adds a new node to the digraph.
    13321349      Node addNode() {
    13331350        return INVALID;
    13341351      }
    13351352
    1336       /// \brief Adds a new arc connects the given two nodes.
    1337       ///
    1338       /// Adds a new arc connects the the given two nodes.
    1339       Edge addArc(const Node&, const Node&) {
     1353      /// \brief Add a new edge connecting the given two nodes.
     1354      ///
     1355      /// This function adds a new edge connecting the given two nodes
     1356      /// of the graph.
     1357      Edge addEdge(const Node&, const Node&) {
    13401358        return INVALID;
    13411359      }
     
    13561374    };
    13571375
    1358     /// \brief An empty erasable digraph class.
    1359     ///
    1360     /// This class provides beside the core digraph features core erase
    1361     /// functions for the digraph structure. The main difference between
    1362     /// the base and this interface is that the digraph alterations
    1363     /// should handled already on this level.
     1376    /// \brief Skeleton class for erasable directed graphs.
     1377    ///
     1378    /// This class describes the interface of erasable directed graphs.
     1379    /// It extends \ref BaseDigraphComponent with functions for removing
     1380    /// nodes and arcs from the digraph.
     1381    /// This concept requires \ref AlterableDigraphComponent.
    13641382    template <typename BAS = BaseDigraphComponent>
    13651383    class ErasableDigraphComponent : public BAS {
     
    13721390      /// \brief Erase a node from the digraph.
    13731391      ///
    1374       /// Erase a node from the digraph. This function should
    1375       /// erase all arcs connecting to the node.
     1392      /// This function erases the given node from the digraph and all arcs
     1393      /// connected to the node.
    13761394      void erase(const Node&) {}
    13771395
    13781396      /// \brief Erase an arc from the digraph.
    13791397      ///
    1380       /// Erase an arc from the digraph.
    1381       ///
     1398      /// This function erases the given arc from the digraph.
    13821399      void erase(const Arc&) {}
    13831400
     
    13861403        void constraints() {
    13871404          checkConcept<Base, _Digraph>();
    1388           typename _Digraph::Node node;
     1405          const typename _Digraph::Node node(INVALID);
    13891406          digraph.erase(node);
    1390           typename _Digraph::Arc arc;
     1407          const typename _Digraph::Arc arc(INVALID);
    13911408          digraph.erase(arc);
    13921409        }
     
    13961413    };
    13971414
    1398     /// \brief An empty erasable base undirected graph class.
    1399     ///
    1400     /// This class provides beside the core undirected graph features
    1401     /// core erase functions for the undirceted graph structure. The
    1402     /// main difference between the base and this interface is that
    1403     /// the graph alterations should handled already on this level.
     1415    /// \brief Skeleton class for erasable undirected graphs.
     1416    ///
     1417    /// This class describes the interface of erasable undirected graphs.
     1418    /// It extends \ref BaseGraphComponent with functions for removing
     1419    /// nodes and edges from the graph.
     1420    /// This concept requires \ref AlterableGraphComponent.
    14041421    template <typename BAS = BaseGraphComponent>
    14051422    class ErasableGraphComponent : public BAS {
     
    14121429      /// \brief Erase a node from the graph.
    14131430      ///
    1414       /// Erase a node from the graph. This function should erase
    1415       /// arcs connecting to the node.
     1431      /// This function erases the given node from the graph and all edges
     1432      /// connected to the node.
    14161433      void erase(const Node&) {}
    14171434
    1418       /// \brief Erase an arc from the graph.
    1419       ///
    1420       /// Erase an arc from the graph.
    1421       ///
     1435      /// \brief Erase an edge from the digraph.
     1436      ///
     1437      /// This function erases the given edge from the digraph.
    14221438      void erase(const Edge&) {}
    14231439
     
    14261442        void constraints() {
    14271443          checkConcept<Base, _Graph>();
    1428           typename _Graph::Node node;
     1444          const typename _Graph::Node node(INVALID);
    14291445          graph.erase(node);
    1430           typename _Graph::Edge edge;
     1446          const typename _Graph::Edge edge(INVALID);
    14311447          graph.erase(edge);
    14321448        }
     
    14361452    };
    14371453
    1438     /// \brief An empty clearable base digraph class.
    1439     ///
    1440     /// This class provides beside the core digraph features core clear
    1441     /// functions for the digraph structure. The main difference between
    1442     /// the base and this interface is that the digraph alterations
    1443     /// should handled already on this level.
     1454    /// \brief Skeleton class for clearable directed graphs.
     1455    ///
     1456    /// This class describes the interface of clearable directed graphs.
     1457    /// It extends \ref BaseDigraphComponent with a function for clearing
     1458    /// the digraph.
     1459    /// This concept requires \ref AlterableDigraphComponent.
    14441460    template <typename BAS = BaseDigraphComponent>
    14451461    class ClearableDigraphComponent : public BAS {
     
    14501466      /// \brief Erase all nodes and arcs from the digraph.
    14511467      ///
    1452       /// Erase all nodes and arcs from the digraph.
    1453       ///
     1468      /// This function erases all nodes and arcs from the digraph.
    14541469      void clear() {}
    14551470
     
    14611476        }
    14621477
    1463         _Digraph digraph;
    1464       };
    1465     };
    1466 
    1467     /// \brief An empty clearable base undirected graph class.
    1468     ///
    1469     /// This class provides beside the core undirected graph features
    1470     /// core clear functions for the undirected graph structure. The
    1471     /// main difference between the base and this interface is that
    1472     /// the graph alterations should handled already on this level.
     1478        _Digraph& digraph;
     1479      };
     1480    };
     1481
     1482    /// \brief Skeleton class for clearable undirected graphs.
     1483    ///
     1484    /// This class describes the interface of clearable undirected graphs.
     1485    /// It extends \ref BaseGraphComponent with a function for clearing
     1486    /// the graph.
     1487    /// This concept requires \ref AlterableGraphComponent.
    14731488    template <typename BAS = BaseGraphComponent>
    14741489    class ClearableGraphComponent : public ClearableDigraphComponent<BAS> {
     
    14771492      typedef BAS Base;
    14781493
     1494      /// \brief Erase all nodes and edges from the graph.
     1495      ///
     1496      /// This function erases all nodes and edges from the graph.
     1497      void clear() {}
     1498
    14791499      template <typename _Graph>
    14801500      struct Constraints {
    14811501        void constraints() {
    1482           checkConcept<ClearableGraphComponent<Base>, _Graph>();
    1483         }
    1484 
    1485         _Graph graph;
     1502          checkConcept<Base, _Graph>();
     1503          graph.clear();
     1504        }
     1505
     1506        _Graph& graph;
    14861507      };
    14871508    };
  • lemon/concepts/heap.h

    r559 r584  
    7272      /// \c PRE_HEAP (<tt>-1</tt>) to any element to be put in the heap.
    7373      enum State {
    74         IN_HEAP = 0,    ///< The "in heap" state constant.
    75         PRE_HEAP = -1,  ///< The "pre heap" state constant.
    76         POST_HEAP = -2  ///< The "post heap" state constant.
     74        IN_HEAP = 0,    ///< = 0. The "in heap" state constant.
     75        PRE_HEAP = -1,  ///< = -1. The "pre heap" state constant.
     76        POST_HEAP = -2  ///< = -2. The "post heap" state constant.
    7777      };
    7878
  • lemon/connectivity.h

    r559 r586  
    3333#include <functional>
    3434
    35 /// \ingroup connectivity
     35/// \ingroup graph_properties
    3636/// \file
    3737/// \brief Connectivity algorithms
     
    4141namespace lemon {
    4242
    43   /// \ingroup connectivity
     43  /// \ingroup graph_properties
    4444  ///
    4545  /// \brief Check whether the given undirected graph is connected.
     
    6464  }
    6565
    66   /// \ingroup connectivity
     66  /// \ingroup graph_properties
    6767  ///
    6868  /// \brief Count the number of connected components of an undirected graph
     
    106106  }
    107107
    108   /// \ingroup connectivity
     108  /// \ingroup graph_properties
    109109  ///
    110110  /// \brief Find the connected components of an undirected graph
    111111  ///
    112112  /// Find the connected components of an undirected graph.
     113  ///
     114  /// \image html connected_components.png
     115  /// \image latex connected_components.eps "Connected components" width=\textwidth
    113116  ///
    114117  /// \param graph The graph. It must be undirected.
     
    118121  /// set continuously.
    119122  /// \return The number of components
    120   ///
    121123  template <class Graph, class NodeMap>
    122124  int connectedComponents(const Graph &graph, NodeMap &compMap) {
     
    228230
    229231
    230   /// \ingroup connectivity
     232  /// \ingroup graph_properties
    231233  ///
    232234  /// \brief Check whether the given directed graph is strongly connected.
     
    286288  }
    287289
    288   /// \ingroup connectivity
     290  /// \ingroup graph_properties
    289291  ///
    290292  /// \brief Count the strongly connected components of a directed graph
     
    350352  }
    351353
    352   /// \ingroup connectivity
     354  /// \ingroup graph_properties
    353355  ///
    354356  /// \brief Find the strongly connected components of a directed graph
     
    362364  /// a lower.
    363365  ///
     366  /// \image html strongly_connected_components.png
     367  /// \image latex strongly_connected_components.eps "Strongly connected components" width=\textwidth
     368  ///
    364369  /// \param digraph The digraph.
    365370  /// \retval compMap A writable node map. The values will be set from 0 to
     
    368373  /// will be set continuously.
    369374  /// \return The number of components
    370   ///
    371375  template <typename Digraph, typename NodeMap>
    372376  int stronglyConnectedComponents(const Digraph& digraph, NodeMap& compMap) {
     
    417421  }
    418422
    419   /// \ingroup connectivity
     423  /// \ingroup graph_properties
    420424  ///
    421425  /// \brief Find the cut arcs of the strongly connected components.
     
    701705  int countBiNodeConnectedComponents(const Graph& graph);
    702706
    703   /// \ingroup connectivity
     707  /// \ingroup graph_properties
    704708  ///
    705709  /// \brief Checks the graph is bi-node-connected.
     
    716720  }
    717721
    718   /// \ingroup connectivity
     722  /// \ingroup graph_properties
    719723  ///
    720724  /// \brief Count the biconnected components.
     
    751755  }
    752756
    753   /// \ingroup connectivity
     757  /// \ingroup graph_properties
    754758  ///
    755759  /// \brief Find the bi-node-connected components.
     
    759763  /// relation on the undirected edges. Two undirected edge are in relationship
    760764  /// when they are on same circle.
     765  ///
     766  /// \image html node_biconnected_components.png
     767  /// \image latex node_biconnected_components.eps "bi-node-connected components" width=\textwidth
    761768  ///
    762769  /// \param graph The graph.
     
    766773  /// will be set continuously.
    767774  /// \return The number of components.
    768   ///
    769775  template <typename Graph, typename EdgeMap>
    770776  int biNodeConnectedComponents(const Graph& graph,
     
    794800  }
    795801
    796   /// \ingroup connectivity
     802  /// \ingroup graph_properties
    797803  ///
    798804  /// \brief Find the bi-node-connected cut nodes.
     
    10241030  int countBiEdgeConnectedComponents(const Graph& graph);
    10251031
    1026   /// \ingroup connectivity
     1032  /// \ingroup graph_properties
    10271033  ///
    10281034  /// \brief Checks that the graph is bi-edge-connected.
     
    10391045  }
    10401046
    1041   /// \ingroup connectivity
     1047  /// \ingroup graph_properties
    10421048  ///
    10431049  /// \brief Count the bi-edge-connected components.
     
    10741080  }
    10751081
    1076   /// \ingroup connectivity
     1082  /// \ingroup graph_properties
    10771083  ///
    10781084  /// \brief Find the bi-edge-connected components.
     
    10821088  /// relation on the nodes. Two nodes are in relationship when they are
    10831089  /// connected at least two edge-disjoint paths.
     1090  ///
     1091  /// \image html edge_biconnected_components.png
     1092  /// \image latex edge_biconnected_components.eps "bi-edge-connected components" width=\textwidth
    10841093  ///
    10851094  /// \param graph The graph.
     
    10891098  /// will be set continuously.
    10901099  /// \return The number of components.
    1091   ///
    10921100  template <typename Graph, typename NodeMap>
    10931101  int biEdgeConnectedComponents(const Graph& graph, NodeMap& compMap) {
     
    11161124  }
    11171125
    1118   /// \ingroup connectivity
     1126  /// \ingroup graph_properties
    11191127  ///
    11201128  /// \brief Find the bi-edge-connected cut edges.
     
    11801188  }
    11811189
    1182   /// \ingroup connectivity
     1190  /// \ingroup graph_properties
    11831191  ///
    11841192  /// \brief Sort the nodes of a DAG into topolgical order.
     
    12191227  }
    12201228
    1221   /// \ingroup connectivity
     1229  /// \ingroup graph_properties
    12221230  ///
    12231231  /// \brief Sort the nodes of a DAG into topolgical order.
     
    12741282  }
    12751283
    1276   /// \ingroup connectivity
     1284  /// \ingroup graph_properties
    12771285  ///
    12781286  /// \brief Check that the given directed graph is a DAG.
     
    13161324  }
    13171325
    1318   /// \ingroup connectivity
     1326  /// \ingroup graph_properties
    13191327  ///
    13201328  /// \brief Check that the given undirected graph is acyclic.
     
    13501358  }
    13511359
    1352   /// \ingroup connectivity
     1360  /// \ingroup graph_properties
    13531361  ///
    13541362  /// \brief Check that the given undirected graph is tree.
     
    14421450  }
    14431451
    1444   /// \ingroup connectivity
     1452  /// \ingroup graph_properties
    14451453  ///
    14461454  /// \brief Check if the given undirected graph is bipartite or not
     
    14791487  }
    14801488
    1481   /// \ingroup connectivity
     1489  /// \ingroup graph_properties
    14821490  ///
    14831491  /// \brief Check if the given undirected graph is bipartite or not
     
    14871495  /// During the execution, the \c partMap will be set as the two
    14881496  /// partitions of the graph.
     1497  ///
     1498  /// \image html bipartite_partitions.png
     1499  /// \image latex bipartite_partitions.eps "Bipartite partititions" width=\textwidth
     1500  ///
    14891501  /// \param graph The undirected graph.
    14901502  /// \retval partMap A writable bool map of nodes. It will be set as the
  • lemon/core.h

    r559 r581  
    13161316    virtual void clear() {
    13171317      for(NodeIt n(_g);n!=INVALID;++n) {
    1318         _head.set(n, INVALID);
     1318        _head[n] = INVALID;
    13191319      }
    13201320    }
     
    13231323      Node s = _g.source(arc);
    13241324      Node t = _g.target(arc);
    1325       _left.set(arc, INVALID);
    1326       _right.set(arc, INVALID);
     1325      _left[arc] = INVALID;
     1326      _right[arc] = INVALID;
    13271327
    13281328      Arc e = _head[s];
    13291329      if (e == INVALID) {
    1330         _head.set(s, arc);
    1331         _parent.set(arc, INVALID);
     1330        _head[s] = arc;
     1331        _parent[arc] = INVALID;
    13321332        return;
    13331333      }
     
    13351335        if (t < _g.target(e)) {
    13361336          if (_left[e] == INVALID) {
    1337             _left.set(e, arc);
    1338             _parent.set(arc, e);
     1337            _left[e] = arc;
     1338            _parent[arc] = e;
    13391339            splay(arc);
    13401340            return;
     
    13441344        } else {
    13451345          if (_right[e] == INVALID) {
    1346             _right.set(e, arc);
    1347             _parent.set(arc, e);
     1346            _right[e] = arc;
     1347            _parent[arc] = e;
    13481348            splay(arc);
    13491349            return;
     
    13581358      if (_left[arc] == INVALID) {
    13591359        if (_right[arc] != INVALID) {
    1360           _parent.set(_right[arc], _parent[arc]);
     1360          _parent[_right[arc]] = _parent[arc];
    13611361        }
    13621362        if (_parent[arc] != INVALID) {
    13631363          if (_left[_parent[arc]] == arc) {
    1364             _left.set(_parent[arc], _right[arc]);
     1364            _left[_parent[arc]] = _right[arc];
    13651365          } else {
    1366             _right.set(_parent[arc], _right[arc]);
     1366            _right[_parent[arc]] = _right[arc];
    13671367          }
    13681368        } else {
    1369           _head.set(_g.source(arc), _right[arc]);
     1369          _head[_g.source(arc)] = _right[arc];
    13701370        }
    13711371      } else if (_right[arc] == INVALID) {
    1372         _parent.set(_left[arc], _parent[arc]);
     1372        _parent[_left[arc]] = _parent[arc];
    13731373        if (_parent[arc] != INVALID) {
    13741374          if (_left[_parent[arc]] == arc) {
    1375             _left.set(_parent[arc], _left[arc]);
     1375            _left[_parent[arc]] = _left[arc];
    13761376          } else {
    1377             _right.set(_parent[arc], _left[arc]);
     1377            _right[_parent[arc]] = _left[arc];
    13781378          }
    13791379        } else {
    1380           _head.set(_g.source(arc), _left[arc]);
     1380          _head[_g.source(arc)] = _left[arc];
    13811381        }
    13821382      } else {
     
    13881388          }
    13891389          Arc s = _parent[e];
    1390           _right.set(_parent[e], _left[e]);
     1390          _right[_parent[e]] = _left[e];
    13911391          if (_left[e] != INVALID) {
    1392             _parent.set(_left[e], _parent[e]);
     1392            _parent[_left[e]] = _parent[e];
    13931393          }
    13941394
    1395           _left.set(e, _left[arc]);
    1396           _parent.set(_left[arc], e);
    1397           _right.set(e, _right[arc]);
    1398           _parent.set(_right[arc], e);
    1399 
    1400           _parent.set(e, _parent[arc]);
     1395          _left[e] = _left[arc];
     1396          _parent[_left[arc]] = e;
     1397          _right[e] = _right[arc];
     1398          _parent[_right[arc]] = e;
     1399
     1400          _parent[e] = _parent[arc];
    14011401          if (_parent[arc] != INVALID) {
    14021402            if (_left[_parent[arc]] == arc) {
    1403               _left.set(_parent[arc], e);
     1403              _left[_parent[arc]] = e;
    14041404            } else {
    1405               _right.set(_parent[arc], e);
     1405              _right[_parent[arc]] = e;
    14061406            }
    14071407          }
    14081408          splay(s);
    14091409        } else {
    1410           _right.set(e, _right[arc]);
    1411           _parent.set(_right[arc], e);
    1412           _parent.set(e, _parent[arc]);
     1410          _right[e] = _right[arc];
     1411          _parent[_right[arc]] = e;
     1412          _parent[e] = _parent[arc];
    14131413
    14141414          if (_parent[arc] != INVALID) {
    14151415            if (_left[_parent[arc]] == arc) {
    1416               _left.set(_parent[arc], e);
     1416              _left[_parent[arc]] = e;
    14171417            } else {
    1418               _right.set(_parent[arc], e);
     1418              _right[_parent[arc]] = e;
    14191419            }
    14201420          } else {
    1421             _head.set(_g.source(arc), e);
     1421            _head[_g.source(arc)] = e;
    14221422          }
    14231423        }
     
    14311431      if (a < m) {
    14321432        Arc left = refreshRec(v,a,m-1);
    1433         _left.set(me, left);
    1434         _parent.set(left, me);
     1433        _left[me] = left;
     1434        _parent[left] = me;
    14351435      } else {
    1436         _left.set(me, INVALID);
     1436        _left[me] = INVALID;
    14371437      }
    14381438      if (m < b) {
    14391439        Arc right = refreshRec(v,m+1,b);
    1440         _right.set(me, right);
    1441         _parent.set(right, me);
     1440        _right[me] = right;
     1441        _parent[right] = me;
    14421442      } else {
    1443         _right.set(me, INVALID);
     1443        _right[me] = INVALID;
    14441444      }
    14451445      return me;
     
    14531453          std::sort(v.begin(),v.end(),ArcLess(_g));
    14541454          Arc head = refreshRec(v,0,v.size()-1);
    1455           _head.set(n, head);
    1456           _parent.set(head, INVALID);
    1457         }
    1458         else _head.set(n, INVALID);
     1455          _head[n] = head;
     1456          _parent[head] = INVALID;
     1457        }
     1458        else _head[n] = INVALID;
    14591459      }
    14601460    }
     
    14621462    void zig(Arc v) {
    14631463      Arc w = _parent[v];
    1464       _parent.set(v, _parent[w]);
    1465       _parent.set(w, v);
    1466       _left.set(w, _right[v]);
    1467       _right.set(v, w);
     1464      _parent[v] = _parent[w];
     1465      _parent[w] = v;
     1466      _left[w] = _right[v];
     1467      _right[v] = w;
    14681468      if (_parent[v] != INVALID) {
    14691469        if (_right[_parent[v]] == w) {
    1470           _right.set(_parent[v], v);
     1470          _right[_parent[v]] = v;
    14711471        } else {
    1472           _left.set(_parent[v], v);
     1472          _left[_parent[v]] = v;
    14731473        }
    14741474      }
    14751475      if (_left[w] != INVALID){
    1476         _parent.set(_left[w], w);
     1476        _parent[_left[w]] = w;
    14771477      }
    14781478    }
     
    14801480    void zag(Arc v) {
    14811481      Arc w = _parent[v];
    1482       _parent.set(v, _parent[w]);
    1483       _parent.set(w, v);
    1484       _right.set(w, _left[v]);
    1485       _left.set(v, w);
     1482      _parent[v] = _parent[w];
     1483      _parent[w] = v;
     1484      _right[w] = _left[v];
     1485      _left[v] = w;
    14861486      if (_parent[v] != INVALID){
    14871487        if (_left[_parent[v]] == w) {
    1488           _left.set(_parent[v], v);
     1488          _left[_parent[v]] = v;
    14891489        } else {
    1490           _right.set(_parent[v], v);
     1490          _right[_parent[v]] = v;
    14911491        }
    14921492      }
    14931493      if (_right[w] != INVALID){
    1494         _parent.set(_right[w], w);
     1494        _parent[_right[w]] = w;
    14951495      }
    14961496    }
  • lemon/cplex.cc

    r551 r576  
    7373    int status;
    7474    _prob = CPXcreateprob(cplexEnv(), &status, "Cplex problem");
     75    messageLevel(MESSAGE_NOTHING);
    7576  }
    7677
     
    7980    int status;
    8081    _prob = CPXcreateprob(cplexEnv(), &status, "Cplex problem");
     82    messageLevel(MESSAGE_NOTHING);
    8183  }
    8284
     
    8789    rows = cplex.rows;
    8890    cols = cplex.cols;
     91    messageLevel(MESSAGE_NOTHING);
    8992  }
    9093
     
    437440    rows.clear();
    438441    cols.clear();
     442  }
     443
     444  void CplexBase::_messageLevel(MessageLevel level) {
     445    switch (level) {
     446    case MESSAGE_NOTHING:
     447      _message_enabled = false;
     448      break;
     449    case MESSAGE_ERROR:
     450    case MESSAGE_WARNING:
     451    case MESSAGE_NORMAL:
     452    case MESSAGE_VERBOSE:
     453      _message_enabled = true;
     454      break;
     455    }
     456  }
     457
     458  void CplexBase::_applyMessageLevel() {
     459    CPXsetintparam(cplexEnv(), CPX_PARAM_SCRIND,
     460                   _message_enabled ? CPX_ON : CPX_OFF);
    439461  }
    440462
     
    508530  CplexLp::SolveExitStatus CplexLp::_solve() {
    509531    _clear_temporals();
     532    _applyMessageLevel();
    510533    return convertStatus(CPXlpopt(cplexEnv(), _prob));
    511534  }
     
    513536  CplexLp::SolveExitStatus CplexLp::solvePrimal() {
    514537    _clear_temporals();
     538    _applyMessageLevel();
    515539    return convertStatus(CPXprimopt(cplexEnv(), _prob));
    516540  }
     
    518542  CplexLp::SolveExitStatus CplexLp::solveDual() {
    519543    _clear_temporals();
     544    _applyMessageLevel();
    520545    return convertStatus(CPXdualopt(cplexEnv(), _prob));
    521546  }
     
    523548  CplexLp::SolveExitStatus CplexLp::solveBarrier() {
    524549    _clear_temporals();
     550    _applyMessageLevel();
    525551    return convertStatus(CPXbaropt(cplexEnv(), _prob));
    526552  }
     
    601627  }
    602628
    603   //7.5-os cplex statusai (Vigyazat: a 9.0-asei masok!)
     629  // Cplex 7.0 status values
    604630  // This table lists the statuses, returned by the CPXgetstat()
    605631  // routine, for solutions to LP problems or mixed integer problems. If
     
    648674  //       User pivot used
    649675  //
    650   //     Ezeket hova tegyem:
     676  // Pending return values
    651677  // ??case CPX_ABORT_DUAL_INFEAS
    652678  // ??case CPX_ABORT_CROSSOVER
     
    719745    statusSwitch(cplexEnv(),stat);
    720746    //CPXgetstat(cplexEnv(), _prob);
    721     //printf("A primal status: %d, CPX_OPTIMAL=%d \n",stat,CPX_OPTIMAL);
    722747    switch (stat) {
    723748    case 0:
     
    752777  }
    753778
    754   //9.0-as cplex verzio statusai
     779  // Cplex 9.0 status values
    755780  // CPX_STAT_ABORT_DUAL_OBJ_LIM
    756781  // CPX_STAT_ABORT_IT_LIM
     
    865890  CplexMip::SolveExitStatus CplexMip::_solve() {
    866891    int status;
     892    _applyMessageLevel();
    867893    status = CPXmipopt (cplexEnv(), _prob);
    868894    if (status==0)
  • lemon/cplex.h

    r551 r576  
    145145    virtual void _clear();
    146146
     147    virtual void _messageLevel(MessageLevel level);
     148    void _applyMessageLevel();
     149
     150    bool _message_enabled;
     151
    147152  public:
    148153
    149154    /// Returns the used \c CplexEnv instance
    150155    const CplexEnv& env() const { return _env; }
     156
     157    /// \brief Returns the const cpxenv pointer
    151158    ///
     159    /// \note The cpxenv might be destructed with the solver.
    152160    const cpxenv* cplexEnv() const { return _env.cplexEnv(); }
    153161
     162    /// \brief Returns the const cpxenv pointer
     163    ///
     164    /// \note The cpxenv might be destructed with the solver.
     165    cpxenv* cplexEnv() { return _env.cplexEnv(); }
     166
     167    /// Returns the cplex problem object
    154168    cpxlp* cplexLp() { return _prob; }
     169    /// Returns the cplex problem object
    155170    const cpxlp* cplexLp() const { return _prob; }
    156171
  • lemon/dfs.h

    r503 r584  
    207207    typedef Dfs Create;
    208208
    209     ///\name Named template parameters
     209    ///\name Named Template Parameters
    210210
    211211    ///@{
  • lemon/dijkstra.h

    r559 r584  
    287287    typedef Dijkstra Create;
    288288
    289     ///\name Named template parameters
     289    ///\name Named Template Parameters
    290290
    291291    ///@{
  • lemon/dimacs.h

    r561 r584  
    3838  struct DimacsDescriptor
    3939  {
    40     ///File type enum
    41     enum Type
    42       {
    43         NONE, MIN, MAX, SP, MAT
    44       };
     40    ///\brief DIMACS file type enum
     41    ///
     42    ///DIMACS file type enum.
     43    enum Type {
     44      NONE,  ///< Undefined type.
     45      MIN,   ///< DIMACS file type for minimum cost flow problems.
     46      MAX,   ///< DIMACS file type for maximum flow problems.
     47      SP,    ///< DIMACS file type for shostest path problems.
     48      MAT    ///< DIMACS file type for plain graphs and matching problems.
     49    };
    4550    ///The file type
    4651    Type type;
     
    5055    int edgeNum;
    5156    int lineShift;
    52     /// Constructor. Sets the type to NONE.
     57    ///Constructor. It sets the type to \c NONE.
    5358    DimacsDescriptor() : type(NONE) {}
    5459  };
     
    5661  ///Discover the type of a DIMACS file
    5762
    58   ///It starts seeking the beginning of the file for the problem type
    59   ///and size info. The found data is returned in a special struct
    60   ///that can be evaluated and passed to the appropriate reader
    61   ///function.
     63  ///This function starts seeking the beginning of the given file for the
     64  ///problem type and size info.
     65  ///The found data is returned in a special struct that can be evaluated
     66  ///and passed to the appropriate reader function.
    6267  DimacsDescriptor dimacsType(std::istream& is)
    6368  {
     
    97102
    98103
    99 
    100   /// DIMACS minimum cost flow reader function.
     104  /// \brief DIMACS minimum cost flow reader function.
    101105  ///
    102106  /// This function reads a minimum cost flow instance from DIMACS format,
     
    254258  }
    255259
    256   /// DIMACS maximum flow reader function.
     260  /// \brief DIMACS maximum flow reader function.
    257261  ///
    258262  /// This function reads a maximum flow instance from DIMACS format,
     
    288292  }
    289293
    290   /// DIMACS shortest path reader function.
     294  /// \brief DIMACS shortest path reader function.
    291295  ///
    292296  /// This function reads a shortest path instance from DIMACS format,
     
    314318  }
    315319
    316   /// DIMACS capacitated digraph reader function.
     320  /// \brief DIMACS capacitated digraph reader function.
    317321  ///
    318322  /// This function reads an arc capacitated digraph instance from
     
    360364  }
    361365 
    362   /// DIMACS plain (di)graph reader function.
    363   ///
    364   /// This function reads a (di)graph without any designated nodes and
    365   /// maps from DIMACS format, i.e. from DIMACS files having a line
    366   /// starting with
     366  /// \brief DIMACS plain (di)graph reader function.
     367  ///
     368  /// This function reads a plain (di)graph without any designated nodes
     369  /// and maps (e.g. a matching instance) from DIMACS format, i.e. from
     370  /// DIMACS files having a line starting with
    367371  /// \code
    368372  ///   p mat
  • lemon/elevator.h

    r559 r581  
    7777    void copy(Item i, Vit p)
    7878    {
    79       _where.set(*p=i,p);
     79      _where[*p=i] = p;
    8080    }
    8181    void copy(Vit s, Vit p)
     
    8585          Item i=*s;
    8686          *p=i;
    87           _where.set(i,p);
     87          _where[i] = p;
    8888        }
    8989    }
     
    9292      Item ti=*i;
    9393      Vit ct = _where[ti];
    94       _where.set(ti,_where[*i=*j]);
    95       _where.set(*j,ct);
     94      _where[ti] = _where[*i=*j];
     95      _where[*j] = ct;
    9696      *j=ti;
    9797    }
     
    227227    {
    228228      Item it = *_last_active[_highest_active];
    229       _level.set(it,_level[it]+1);
     229      ++_level[it];
    230230      swap(_last_active[_highest_active]--,_last_active[_highest_active+1]);
    231231      --_first[++_highest_active];
     
    250250        }
    251251      copy(li,_first[new_level]);
    252       _level.set(li,new_level);
     252      _level[li] = new_level;
    253253      _highest_active=new_level;
    254254    }
     
    270270      copy(li,_first[_max_level]);
    271271      --_last_active[_max_level];
    272       _level.set(li,_max_level);
     272      _level[li] = _max_level;
    273273
    274274      while(_highest_active>=0 &&
     
    300300    {
    301301      Item it =*_last_active[level];
    302       _level.set(it,_level[it]+1);
     302      ++_level[it];
    303303      swap(_last_active[level]--, --_first[level+1]);
    304304      if (level+1>_highest_active) ++_highest_active;
     
    320320        }
    321321      copy(ai,_first[new_level]);
    322       _level.set(ai,new_level);
     322      _level[ai] = new_level;
    323323      if (new_level>_highest_active) _highest_active=new_level;
    324324    }
     
    340340      copy(ai,_first[_max_level]);
    341341      --_last_active[_max_level];
    342       _level.set(ai,_max_level);
     342      _level[ai] = _max_level;
    343343
    344344      if (_highest_active==level) {
     
    371371        }
    372372      copy(i,_first[new_level]);
    373       _level.set(i,new_level);
     373      _level[i] = new_level;
    374374      if(new_level>_highest_active) _highest_active=new_level;
    375375    }
     
    383383    ///\pre The item is on the top level.
    384384    void dirtyTopButOne(Item i) {
    385       _level.set(i,_max_level - 1);
     385      _level[i] = _max_level - 1;
    386386    }
    387387
     
    395395      const Vit tl=_first[_max_level];
    396396      for(Vit i=f;i!=tl;++i)
    397         _level.set(*i,_max_level);
     397        _level[*i] = _max_level;
    398398      for(int i=l;i<=_max_level;i++)
    399399        {
     
    434434        {
    435435          *n=i;
    436           _where.set(i,n);
    437           _level.set(i,_max_level);
     436          _where[i] = n;
     437          _level[i] = _max_level;
    438438          ++n;
    439439        }
     
    444444    {
    445445      swap(_where[i],_init_num);
    446       _level.set(i,_init_lev);
     446      _level[i] = _init_lev;
    447447      ++_init_num;
    448448    }
     
    552552    ///\pre Item \c i shouldn't be active before.
    553553    void activate(Item i) {
    554       _active.set(i, true);
     554      _active[i] = true;
    555555
    556556      int level = _level[i];
     
    561561      if (_prev[i] == INVALID || _active[_prev[i]]) return;
    562562      //unlace
    563       _next.set(_prev[i], _next[i]);
     563      _next[_prev[i]] = _next[i];
    564564      if (_next[i] != INVALID) {
    565         _prev.set(_next[i], _prev[i]);
     565        _prev[_next[i]] = _prev[i];
    566566      } else {
    567567        _last[level] = _prev[i];
    568568      }
    569569      //lace
    570       _next.set(i, _first[level]);
    571       _prev.set(_first[level], i);
    572       _prev.set(i, INVALID);
     570      _next[i] = _first[level];
     571      _prev[_first[level]] = i;
     572      _prev[i] = INVALID;
    573573      _first[level] = i;
    574574
     
    580580    ///\pre Item \c i must be active before.
    581581    void deactivate(Item i) {
    582       _active.set(i, false);
     582      _active[i] = false;
    583583      int level = _level[i];
    584584
     
    587587
    588588      //unlace
    589       _prev.set(_next[i], _prev[i]);
     589      _prev[_next[i]] = _prev[i];
    590590      if (_prev[i] != INVALID) {
    591         _next.set(_prev[i], _next[i]);
     591        _next[_prev[i]] = _next[i];
    592592      } else {
    593593        _first[_level[i]] = _next[i];
    594594      }
    595595      //lace
    596       _prev.set(i, _last[level]);
    597       _next.set(_last[level], i);
    598       _next.set(i, INVALID);
     596      _prev[i] = _last[level];
     597      _next[_last[level]] = i;
     598      _next[i] = INVALID;
    599599      _last[level] = i;
    600600
     
    686686      Item i = _first[_highest_active];
    687687      if (_next[i] != INVALID) {
    688         _prev.set(_next[i], INVALID);
     688        _prev[_next[i]] = INVALID;
    689689        _first[_highest_active] = _next[i];
    690690      } else {
     
    692692        _last[_highest_active] = INVALID;
    693693      }
    694       _level.set(i, ++_highest_active);
     694      _level[i] = ++_highest_active;
    695695      if (_first[_highest_active] == INVALID) {
    696696        _first[_highest_active] = i;
    697697        _last[_highest_active] = i;
    698         _prev.set(i, INVALID);
    699         _next.set(i, INVALID);
    700       } else {
    701         _prev.set(_first[_highest_active], i);
    702         _next.set(i, _first[_highest_active]);
     698        _prev[i] = INVALID;
     699        _next[i] = INVALID;
     700      } else {
     701        _prev[_first[_highest_active]] = i;
     702        _next[i] = _first[_highest_active];
    703703        _first[_highest_active] = i;
    704704      }
     
    715715      Item i = _first[_highest_active];
    716716      if (_next[i] != INVALID) {
    717         _prev.set(_next[i], INVALID);
     717        _prev[_next[i]] = INVALID;
    718718        _first[_highest_active] = _next[i];
    719719      } else {
     
    721721        _last[_highest_active] = INVALID;
    722722      }
    723       _level.set(i, _highest_active = new_level);
     723      _level[i] = _highest_active = new_level;
    724724      if (_first[_highest_active] == INVALID) {
    725725        _first[_highest_active] = _last[_highest_active] = i;
    726         _prev.set(i, INVALID);
    727         _next.set(i, INVALID);
    728       } else {
    729         _prev.set(_first[_highest_active], i);
    730         _next.set(i, _first[_highest_active]);
     726        _prev[i] = INVALID;
     727        _next[i] = INVALID;
     728      } else {
     729        _prev[_first[_highest_active]] = i;
     730        _next[i] = _first[_highest_active];
    731731        _first[_highest_active] = i;
    732732      }
     
    739739    void liftHighestActiveToTop() {
    740740      Item i = _first[_highest_active];
    741       _level.set(i, _max_level);
     741      _level[i] = _max_level;
    742742      if (_next[i] != INVALID) {
    743         _prev.set(_next[i], INVALID);
     743        _prev[_next[i]] = INVALID;
    744744        _first[_highest_active] = _next[i];
    745745      } else {
     
    775775      Item i = _first[l];
    776776      if (_next[i] != INVALID) {
    777         _prev.set(_next[i], INVALID);
     777        _prev[_next[i]] = INVALID;
    778778        _first[l] = _next[i];
    779779      } else {
     
    781781        _last[l] = INVALID;
    782782      }
    783       _level.set(i, ++l);
     783      _level[i] = ++l;
    784784      if (_first[l] == INVALID) {
    785785        _first[l] = _last[l] = i;
    786         _prev.set(i, INVALID);
    787         _next.set(i, INVALID);
    788       } else {
    789         _prev.set(_first[l], i);
    790         _next.set(i, _first[l]);
     786        _prev[i] = INVALID;
     787        _next[i] = INVALID;
     788      } else {
     789        _prev[_first[l]] = i;
     790        _next[i] = _first[l];
    791791        _first[l] = i;
    792792      }
     
    804804      Item i = _first[l];
    805805      if (_next[i] != INVALID) {
    806         _prev.set(_next[i], INVALID);
     806        _prev[_next[i]] = INVALID;
    807807        _first[l] = _next[i];
    808808      } else {
     
    810810        _last[l] = INVALID;
    811811      }
    812       _level.set(i, l = new_level);
     812      _level[i] = l = new_level;
    813813      if (_first[l] == INVALID) {
    814814        _first[l] = _last[l] = i;
    815         _prev.set(i, INVALID);
    816         _next.set(i, INVALID);
    817       } else {
    818         _prev.set(_first[l], i);
    819         _next.set(i, _first[l]);
     815        _prev[i] = INVALID;
     816        _next[i] = INVALID;
     817      } else {
     818        _prev[_first[l]] = i;
     819        _next[i] = _first[l];
    820820        _first[l] = i;
    821821      }
     
    833833      Item i = _first[l];
    834834      if (_next[i] != INVALID) {
    835         _prev.set(_next[i], INVALID);
     835        _prev[_next[i]] = INVALID;
    836836        _first[l] = _next[i];
    837837      } else {
     
    839839        _last[l] = INVALID;
    840840      }
    841       _level.set(i, _max_level);
     841      _level[i] = _max_level;
    842842      if (l == _highest_active) {
    843843        while (_highest_active >= 0 && activeFree(_highest_active))
     
    857857    void lift(Item i, int new_level) {
    858858      if (_next[i] != INVALID) {
    859         _prev.set(_next[i], _prev[i]);
     859        _prev[_next[i]] = _prev[i];
    860860      } else {
    861861        _last[new_level] = _prev[i];
    862862      }
    863863      if (_prev[i] != INVALID) {
    864         _next.set(_prev[i], _next[i]);
     864        _next[_prev[i]] = _next[i];
    865865      } else {
    866866        _first[new_level] = _next[i];
    867867      }
    868       _level.set(i, new_level);
     868      _level[i] = new_level;
    869869      if (_first[new_level] == INVALID) {
    870870        _first[new_level] = _last[new_level] = i;
    871         _prev.set(i, INVALID);
    872         _next.set(i, INVALID);
    873       } else {
    874         _prev.set(_first[new_level], i);
    875         _next.set(i, _first[new_level]);
     871        _prev[i] = INVALID;
     872        _next[i] = INVALID;
     873      } else {
     874        _prev[_first[new_level]] = i;
     875        _next[i] = _first[new_level];
    876876        _first[new_level] = i;
    877877      }
     
    889889    ///\pre The item is on the top level.
    890890    void dirtyTopButOne(Item i) {
    891       _level.set(i, _max_level - 1);
     891      _level[i] = _max_level - 1;
    892892    }
    893893
     
    900900        Item n = _first[i];
    901901        while (n != INVALID) {
    902           _level.set(n, _max_level);
     902          _level[n] = _max_level;
    903903          n = _next[n];
    904904        }
     
    938938      for(typename ItemSetTraits<GR,Item>::ItemIt i(_graph);
    939939          i != INVALID; ++i) {
    940         _level.set(i, _max_level);
    941         _active.set(i, false);
     940        _level[i] = _max_level;
     941        _active[i] = false;
    942942      }
    943943    }
     
    945945    ///Add an item to the current level.
    946946    void initAddItem(Item i) {
    947       _level.set(i, _init_level);
     947      _level[i] = _init_level;
    948948      if (_last[_init_level] == INVALID) {
    949949        _first[_init_level] = i;
    950950        _last[_init_level] = i;
    951         _prev.set(i, INVALID);
    952         _next.set(i, INVALID);
    953       } else {
    954         _prev.set(i, _last[_init_level]);
    955         _next.set(i, INVALID);
    956         _next.set(_last[_init_level], i);
     951        _prev[i] = INVALID;
     952        _next[i] = INVALID;
     953      } else {
     954        _prev[i] = _last[_init_level];
     955        _next[i] = INVALID;
     956        _next[_last[_init_level]] = i;
    957957        _last[_init_level] = i;
    958958      }
  • lemon/euler.h

    r559 r586  
    2525#include <list>
    2626
    27 /// \ingroup graph_prop
     27/// \ingroup graph_properties
    2828/// \file
    2929/// \brief Euler tour
     
    3737  ///Euler iterator for digraphs.
    3838
    39   /// \ingroup graph_prop
     39  /// \ingroup graph_properties
    4040  ///This iterator converts to the \c Arc type of the digraph and using
    4141  ///operator ++, it provides an Euler tour of a \e directed
     
    124124  ///Euler iterator for graphs.
    125125
    126   /// \ingroup graph_prop
     126  /// \ingroup graph_properties
    127127  ///This iterator converts to the \c Arc (or \c Edge)
    128128  ///type of the digraph and using
     
    229229  ///Checks if the graph is Eulerian
    230230
    231   /// \ingroup graph_prop
     231  /// \ingroup graph_properties
    232232  ///Checks if the graph is Eulerian. It works for both directed and undirected
    233233  ///graphs.
  • lemon/full_graph.h

    r440 r582  
    158158  /// constant space in memory.
    159159  ///
    160   /// This class conforms to the \ref concepts::Digraph "Digraph" concept
    161   /// and it also has an important extra feature that its maps are
    162   /// real \ref concepts::ReferenceMap "reference map"s.
     160  /// This class fully conforms to the \ref concepts::Digraph
     161  /// "Digraph concept".
    163162  ///
    164163  /// The \c FullDigraph and \c FullGraph classes are very similar,
     
    528527  /// space in memory.
    529528  ///
    530   /// This class conforms to the \ref concepts::Graph "Graph" concept
    531   /// and it also has an important extra feature that its maps are
    532   /// real \ref concepts::ReferenceMap "reference map"s.
     529  /// This class fully conforms to the \ref concepts::Graph "Graph concept".
    533530  ///
    534531  /// The \c FullGraph and \c FullDigraph classes are very similar,
  • lemon/glpk.cc

    r566 r576  
    3232    lp = glp_create_prob();
    3333    glp_create_index(lp);
     34    messageLevel(MESSAGE_NOTHING);
    3435  }
    3536
     
    4041    rows = other.rows;
    4142    cols = other.cols;
     43    messageLevel(MESSAGE_NOTHING);
    4244  }
    4345
     
    527529  }
    528530
     531  void GlpkBase::_messageLevel(MessageLevel level) {
     532    switch (level) {
     533    case MESSAGE_NOTHING:
     534      _message_level = GLP_MSG_OFF;
     535      break;
     536    case MESSAGE_ERROR:
     537      _message_level = GLP_MSG_ERR;
     538      break;
     539    case MESSAGE_WARNING:
     540      _message_level = GLP_MSG_ERR;
     541      break;
     542    case MESSAGE_NORMAL:
     543      _message_level = GLP_MSG_ON;
     544      break;
     545    case MESSAGE_VERBOSE:
     546      _message_level = GLP_MSG_ALL;
     547      break;
     548    }
     549  }
     550
    529551  GlpkBase::FreeEnvHelper GlpkBase::freeEnvHelper;
    530552
     
    533555  GlpkLp::GlpkLp()
    534556    : LpBase(), LpSolver(), GlpkBase() {
    535     messageLevel(MESSAGE_NO_OUTPUT);
    536557    presolver(false);
    537558  }
     
    539560  GlpkLp::GlpkLp(const GlpkLp& other)
    540561    : LpBase(other), LpSolver(other), GlpkBase(other) {
    541     messageLevel(MESSAGE_NO_OUTPUT);
    542562    presolver(false);
    543563  }
     
    563583    glp_init_smcp(&smcp);
    564584
    565     switch (_message_level) {
    566     case MESSAGE_NO_OUTPUT:
    567       smcp.msg_lev = GLP_MSG_OFF;
    568       break;
    569     case MESSAGE_ERROR_MESSAGE:
    570       smcp.msg_lev = GLP_MSG_ERR;
    571       break;
    572     case MESSAGE_NORMAL_OUTPUT:
    573       smcp.msg_lev = GLP_MSG_ON;
    574       break;
    575     case MESSAGE_FULL_OUTPUT:
    576       smcp.msg_lev = GLP_MSG_ALL;
    577       break;
    578     }
     585    smcp.msg_lev = _message_level;
    579586    smcp.presolve = _presolve;
    580587
     
    605612    glp_init_smcp(&smcp);
    606613
    607     switch (_message_level) {
    608     case MESSAGE_NO_OUTPUT:
    609       smcp.msg_lev = GLP_MSG_OFF;
    610       break;
    611     case MESSAGE_ERROR_MESSAGE:
    612       smcp.msg_lev = GLP_MSG_ERR;
    613       break;
    614     case MESSAGE_NORMAL_OUTPUT:
    615       smcp.msg_lev = GLP_MSG_ON;
    616       break;
    617     case MESSAGE_FULL_OUTPUT:
    618       smcp.msg_lev = GLP_MSG_ALL;
    619       break;
    620     }
     614    smcp.msg_lev = _message_level;
    621615    smcp.meth = GLP_DUAL;
    622616    smcp.presolve = _presolve;
     
    859853  }
    860854
    861   void GlpkLp::messageLevel(MessageLevel m) {
    862     _message_level = m;
    863   }
    864 
    865855  // GlpkMip members
    866856
    867857  GlpkMip::GlpkMip()
    868858    : LpBase(), MipSolver(), GlpkBase() {
    869     messageLevel(MESSAGE_NO_OUTPUT);
    870859  }
    871860
    872861  GlpkMip::GlpkMip(const GlpkMip& other)
    873862    : LpBase(), MipSolver(), GlpkBase(other) {
    874     messageLevel(MESSAGE_NO_OUTPUT);
    875863  }
    876864
     
    901889    glp_init_smcp(&smcp);
    902890
    903     switch (_message_level) {
    904     case MESSAGE_NO_OUTPUT:
    905       smcp.msg_lev = GLP_MSG_OFF;
    906       break;
    907     case MESSAGE_ERROR_MESSAGE:
    908       smcp.msg_lev = GLP_MSG_ERR;
    909       break;
    910     case MESSAGE_NORMAL_OUTPUT:
    911       smcp.msg_lev = GLP_MSG_ON;
    912       break;
    913     case MESSAGE_FULL_OUTPUT:
    914       smcp.msg_lev = GLP_MSG_ALL;
    915       break;
    916     }
     891    smcp.msg_lev = _message_level;
    917892    smcp.meth = GLP_DUAL;
    918893
     
    939914    glp_init_iocp(&iocp);
    940915
    941     switch (_message_level) {
    942     case MESSAGE_NO_OUTPUT:
    943       iocp.msg_lev = GLP_MSG_OFF;
    944       break;
    945     case MESSAGE_ERROR_MESSAGE:
    946       iocp.msg_lev = GLP_MSG_ERR;
    947       break;
    948     case MESSAGE_NORMAL_OUTPUT:
    949       iocp.msg_lev = GLP_MSG_ON;
    950       break;
    951     case MESSAGE_FULL_OUTPUT:
    952       iocp.msg_lev = GLP_MSG_ALL;
    953       break;
    954     }
     916    iocp.msg_lev = _message_level;
    955917
    956918    if (glp_intopt(lp, &iocp) != 0) return UNSOLVED;
     
    1003965  const char* GlpkMip::_solverName() const { return "GlpkMip"; }
    1004966
    1005   void GlpkMip::messageLevel(MessageLevel m) {
    1006     _message_level = m;
    1007   }
    1008 
    1009967} //END OF NAMESPACE LEMON
  • lemon/glpk.h

    r565 r576  
    100100
    101101    virtual void _clear();
     102
     103    virtual void _messageLevel(MessageLevel level);
    102104
    103105  private:
     
    112114   
    113115    static FreeEnvHelper freeEnvHelper;
     116
     117  protected:
     118   
     119    int _message_level;
    114120   
    115121  public:
     
    192198    void presolver(bool presolve);
    193199
    194     ///Enum for \c messageLevel() parameter
    195     enum MessageLevel {
    196       /// no output (default value)
    197       MESSAGE_NO_OUTPUT = 0,
    198       /// error messages only
    199       MESSAGE_ERROR_MESSAGE = 1,
    200       /// normal output
    201       MESSAGE_NORMAL_OUTPUT = 2,
    202       /// full output (includes informational messages)
    203       MESSAGE_FULL_OUTPUT = 3
    204     };
    205 
    206   private:
    207 
    208     MessageLevel _message_level;
    209 
    210   public:
    211 
    212     ///Set the verbosity of the messages
    213 
    214     ///Set the verbosity of the messages
    215     ///
    216     ///\param m is the level of the messages output by the solver routines.
    217     void messageLevel(MessageLevel m);
    218200  };
    219201
     
    245227    virtual Value _getSolValue() const;
    246228
    247     ///Enum for \c messageLevel() parameter
    248     enum MessageLevel {
    249       /// no output (default value)
    250       MESSAGE_NO_OUTPUT = 0,
    251       /// error messages only
    252       MESSAGE_ERROR_MESSAGE = 1,
    253       /// normal output
    254       MESSAGE_NORMAL_OUTPUT = 2,
    255       /// full output (includes informational messages)
    256       MESSAGE_FULL_OUTPUT = 3
    257     };
    258 
    259   private:
    260 
    261     MessageLevel _message_level;
    262 
    263   public:
    264 
    265     ///Set the verbosity of the messages
    266 
    267     ///Set the verbosity of the messages
    268     ///
    269     ///\param m is the level of the messages output by the solver routines.
    270     void messageLevel(MessageLevel m);
    271229  };
    272230
  • lemon/gomory_hu.h

    r546 r596  
    4343  /// between these nodes. Moreover the components obtained by removing
    4444  /// this edge from the tree determine the corresponding minimum cut.
    45   ///
    4645  /// Therefore once this tree is computed, the minimum cut between any pair
    4746  /// of nodes can easily be obtained.
    4847  ///
    4948  /// The algorithm calculates \e n-1 distinct minimum cuts (currently with
    50   /// the \ref Preflow algorithm), therefore the algorithm has
    51   /// \f$(O(n^3\sqrt{e})\f$ overall time complexity. It calculates a
    52   /// rooted Gomory-Hu tree, its structure and the weights can be obtained
    53   /// by \c predNode(), \c predValue() and \c rootDist().
    54   ///
    55   /// The members \c minCutMap() and \c minCutValue() calculate
     49  /// the \ref Preflow algorithm), thus it has \f$O(n^3\sqrt{e})\f$ overall
     50  /// time complexity. It calculates a rooted Gomory-Hu tree.
     51  /// The structure of the tree and the edge weights can be
     52  /// obtained using \c predNode(), \c predValue() and \c rootDist().
     53  /// The functions \c minCutMap() and \c minCutValue() calculate
    5654  /// the minimum cut and the minimum cut value between any two nodes
    5755  /// in the graph. You can also list (iterate on) the nodes and the
     
    5957  ///
    6058  /// \tparam GR The type of the undirected graph the algorithm runs on.
    61   /// \tparam CAP The type of the edge map describing the edge capacities.
    62   /// It is \ref concepts::Graph::EdgeMap "GR::EdgeMap<int>" by default.
     59  /// \tparam CAP The type of the edge map containing the capacities.
     60  /// The default map type is \ref concepts::Graph::EdgeMap "GR::EdgeMap<int>".
    6361#ifdef DOXYGEN
    6462  template <typename GR,
     
    7169  public:
    7270
    73     /// The graph type
     71    /// The graph type of the algorithm
    7472    typedef GR Graph;
    75     /// The type of the edge capacity map
     73    /// The capacity map type of the algorithm
    7674    typedef CAP Capacity;
    7775    /// The value type of capacities
     
    118116    /// \brief Constructor
    119117    ///
    120     /// Constructor
     118    /// Constructor.
    121119    /// \param graph The undirected graph the algorithm runs on.
    122120    /// \param capacity The edge capacity map.
     
    131129    /// \brief Destructor
    132130    ///
    133     /// Destructor
     131    /// Destructor.
    134132    ~GomoryHu() {
    135133      destroyStructures();
     
    144142      _root = NodeIt(_graph);
    145143      for (NodeIt n(_graph); n != INVALID; ++n) {
    146         _pred->set(n, _root);
    147         _order->set(n, -1);
    148       }
    149       _pred->set(_root, INVALID);
    150       _weight->set(_root, std::numeric_limits<Value>::max());
     144        (*_pred)[n] = _root;
     145        (*_order)[n] = -1;
     146      }
     147      (*_pred)[_root] = INVALID;
     148      (*_weight)[_root] = std::numeric_limits<Value>::max();
    151149    }
    152150
     
    165163        fa.runMinCut();
    166164
    167         _weight->set(n, fa.flowValue());
     165        (*_weight)[n] = fa.flowValue();
    168166
    169167        for (NodeIt nn(_graph); nn != INVALID; ++nn) {
    170168          if (nn != n && fa.minCut(nn) && (*_pred)[nn] == pn) {
    171             _pred->set(nn, n);
     169            (*_pred)[nn] = n;
    172170          }
    173171        }
    174172        if ((*_pred)[pn] != INVALID && fa.minCut((*_pred)[pn])) {
    175           _pred->set(n, (*_pred)[pn]);
    176           _pred->set(pn, n);
    177           _weight->set(n, (*_weight)[pn]);
    178           _weight->set(pn, fa.flowValue());     
    179         }
    180       }
    181 
    182       _order->set(_root, 0);
     173          (*_pred)[n] = (*_pred)[pn];
     174          (*_pred)[pn] = n;
     175          (*_weight)[n] = (*_weight)[pn];
     176          (*_weight)[pn] = fa.flowValue();
     177        }
     178      }
     179
     180      (*_order)[_root] = 0;
    183181      int index = 1;
    184182
     
    191189        }
    192190        while (!st.empty()) {
    193           _order->set(st.back(), index++);
     191          (*_order)[st.back()] = index++;
    194192          st.pop_back();
    195193        }
     
    216214    ///The results of the algorithm can be obtained using these
    217215    ///functions.\n
    218     ///\ref run() "run()" should be called before using them.\n
     216    ///\ref run() should be called before using them.\n
    219217    ///See also \ref MinCutNodeIt and \ref MinCutEdgeIt.
    220218
     
    223221    /// \brief Return the predecessor node in the Gomory-Hu tree.
    224222    ///
    225     /// This function returns the predecessor node in the Gomory-Hu tree.
    226     /// If the node is
    227     /// the root of the Gomory-Hu tree, then it returns \c INVALID.
    228     Node predNode(const Node& node) {
     223    /// This function returns the predecessor node of the given node
     224    /// in the Gomory-Hu tree.
     225    /// If \c node is the root of the tree, then it returns \c INVALID.
     226    ///
     227    /// \pre \ref run() must be called before using this function.
     228    Node predNode(const Node& node) const {
    229229      return (*_pred)[node];
    230     }
    231 
    232     /// \brief Return the distance from the root node in the Gomory-Hu tree.
    233     ///
    234     /// This function returns the distance of \c node from the root node
    235     /// in the Gomory-Hu tree.
    236     int rootDist(const Node& node) {
    237       return (*_order)[node];
    238230    }
    239231
     
    241233    /// Gomory-Hu tree.
    242234    ///
    243     /// This function returns the weight of the predecessor edge in the
    244     /// Gomory-Hu tree.  If the node is the root, the result is undefined.
    245     Value predValue(const Node& node) {
     235    /// This function returns the weight of the predecessor edge of the
     236    /// given node in the Gomory-Hu tree.
     237    /// If \c node is the root of the tree, the result is undefined.
     238    ///
     239    /// \pre \ref run() must be called before using this function.
     240    Value predValue(const Node& node) const {
    246241      return (*_weight)[node];
    247242    }
    248243
     244    /// \brief Return the distance from the root node in the Gomory-Hu tree.
     245    ///
     246    /// This function returns the distance of the given node from the root
     247    /// node in the Gomory-Hu tree.
     248    ///
     249    /// \pre \ref run() must be called before using this function.
     250    int rootDist(const Node& node) const {
     251      return (*_order)[node];
     252    }
     253
    249254    /// \brief Return the minimum cut value between two nodes
    250255    ///
    251     /// This function returns the minimum cut value between two nodes. The
    252     /// algorithm finds the nearest common ancestor in the Gomory-Hu
    253     /// tree and calculates the minimum weight edge on the paths to
    254     /// the ancestor.
     256    /// This function returns the minimum cut value between the nodes
     257    /// \c s and \c t.
     258    /// It finds the nearest common ancestor of the given nodes in the
     259    /// Gomory-Hu tree and calculates the minimum weight edge on the
     260    /// paths to the ancestor.
     261    ///
     262    /// \pre \ref run() must be called before using this function.
    255263    Value minCutValue(const Node& s, const Node& t) const {
    256264      Node sn = s, tn = t;
     
    275283    /// \c s to \c true and the other nodes to \c false.
    276284    ///
    277     /// For higher level interfaces, see MinCutNodeIt and MinCutEdgeIt.
     285    /// For higher level interfaces see MinCutNodeIt and MinCutEdgeIt.
     286    ///
     287    /// \param s The base node.
     288    /// \param t The node you want to separate from node \c s.
     289    /// \param cutMap The cut will be returned in this map.
     290    /// It must be a \c bool (or convertible) \ref concepts::ReadWriteMap
     291    /// "ReadWriteMap" on the graph nodes.
     292    ///
     293    /// \return The value of the minimum cut between \c s and \c t.
     294    ///
     295    /// \pre \ref run() must be called before using this function.
    278296    template <typename CutMap>
    279     Value minCutMap(const Node& s, ///< The base node.
     297    Value minCutMap(const Node& s, ///<
    280298                    const Node& t,
    281                     ///< The node you want to separate from node \c s.
     299                    ///<
    282300                    CutMap& cutMap
    283                     ///< The cut will be returned in this map.
    284                     /// It must be a \c bool (or convertible)
    285                     /// \ref concepts::ReadWriteMap "ReadWriteMap"
    286                     /// on the graph nodes.
     301                    ///<
    287302                    ) const {
    288303      Node sn = s, tn = t;
     
    310325
    311326      typename Graph::template NodeMap<bool> reached(_graph, false);
    312       reached.set(_root, true);
     327      reached[_root] = true;
    313328      cutMap.set(_root, !s_root);
    314       reached.set(rn, true);
     329      reached[rn] = true;
    315330      cutMap.set(rn, s_root);
    316331
     
    339354   
    340355    /// This iterator class lists the nodes of a minimum cut found by
    341     /// GomoryHu. Before using it, you must allocate a GomoryHu class,
     356    /// GomoryHu. Before using it, you must allocate a GomoryHu class
    342357    /// and call its \ref GomoryHu::run() "run()" method.
    343358    ///
     
    436451   
    437452    /// This iterator class lists the edges of a minimum cut found by
    438     /// GomoryHu. Before using it, you must allocate a GomoryHu class,
     453    /// GomoryHu. Before using it, you must allocate a GomoryHu class
    439454    /// and call its \ref GomoryHu::run() "run()" method.
    440455    ///
     
    448463    ///   value+=capacities[e];
    449464    /// \endcode
    450     /// the result will be the same as it is returned by
    451     /// \ref GomoryHu::minCutValue() "gom.minCutValue(s,t)"
     465    /// The result will be the same as the value returned by
     466    /// \ref GomoryHu::minCutValue() "gom.minCutValue(s,t)".
    452467    class MinCutEdgeIt
    453468    {
     
    469484     
    470485    public:
     486      /// Constructor
     487
     488      /// Constructor.
     489      ///
    471490      MinCutEdgeIt(GomoryHu const &gomory,
    472491                   ///< The GomoryHu class. You must call its
     
    479498                   ///< If it is \c true (default) then the listed arcs
    480499                   ///  will be oriented from the
    481                    ///  the nodes of the component containing \c s,
     500                   ///  nodes of the component containing \c s,
    482501                   ///  otherwise they will be oriented in the opposite
    483502                   ///  direction.
  • lemon/graph_to_eps.h

    r559 r584  
    269269    ///\image html nodeshape_1.png
    270270    ///\image latex nodeshape_1.eps "SQUARE shape (1)" width=2cm
    271     ///
    272271    SQUARE=1,
    273272    /// = 2
    274273    ///\image html nodeshape_2.png
    275274    ///\image latex nodeshape_2.eps "DIAMOND shape (2)" width=2cm
    276     ///
    277275    DIAMOND=2,
    278276    /// = 3
    279277    ///\image html nodeshape_3.png
    280     ///\image latex nodeshape_2.eps "MALE shape (4)" width=2cm
    281     ///
     278    ///\image latex nodeshape_3.eps "MALE shape (3)" width=2cm
    282279    MALE=3,
    283280    /// = 4
    284281    ///\image html nodeshape_4.png
    285     ///\image latex nodeshape_2.eps "FEMALE shape (4)" width=2cm
    286     ///
     282    ///\image latex nodeshape_4.eps "FEMALE shape (4)" width=2cm
    287283    FEMALE=4
    288284  };
  • lemon/grid_graph.h

    r559 r582  
    498498  ///
    499499  /// This graph type fully conforms to the \ref concepts::Graph
    500   /// "Graph" concept, and it also has an important extra feature
    501   /// that its maps are real \ref concepts::ReferenceMap
    502   /// "reference map"s.
     500  /// "Graph concept".
    503501  class GridGraph : public ExtendedGridGraphBase {
    504502  public:
  • lemon/hao_orlin.h

    r559 r597  
    3232/// \brief Implementation of the Hao-Orlin algorithm.
    3333///
    34 /// Implementation of the Hao-Orlin algorithm class for testing network
    35 /// reliability.
     34/// Implementation of the Hao-Orlin algorithm for finding a minimum cut
     35/// in a digraph.
    3636
    3737namespace lemon {
     
    3939  /// \ingroup min_cut
    4040  ///
    41   /// \brief %Hao-Orlin algorithm to find a minimum cut in directed graphs.
     41  /// \brief Hao-Orlin algorithm for finding a minimum cut in a digraph.
    4242  ///
    43   /// Hao-Orlin calculates a minimum cut in a directed graph
    44   /// \f$D=(V,A)\f$. It takes a fixed node \f$ source \in V \f$ and
     43  /// This class implements the Hao-Orlin algorithm for finding a minimum
     44  /// value cut in a directed graph \f$D=(V,A)\f$.
     45  /// It takes a fixed node \f$ source \in V \f$ and
    4546  /// consists of two phases: in the first phase it determines a
    4647  /// minimum cut with \f$ source \f$ on the source-side (i.e. a set
    47   /// \f$ X\subsetneq V \f$ with \f$ source \in X \f$ and minimal
    48   /// out-degree) and in the second phase it determines a minimum cut
     48  /// \f$ X\subsetneq V \f$ with \f$ source \in X \f$ and minimal outgoing
     49  /// capacity) and in the second phase it determines a minimum cut
    4950  /// with \f$ source \f$ on the sink-side (i.e. a set
    50   /// \f$ X\subsetneq V \f$ with \f$ source \notin X \f$ and minimal
    51   /// out-degree). Obviously, the smaller of these two cuts will be a
     51  /// \f$ X\subsetneq V \f$ with \f$ source \notin X \f$ and minimal outgoing
     52  /// capacity). Obviously, the smaller of these two cuts will be a
    5253  /// minimum cut of \f$ D \f$. The algorithm is a modified
    53   /// push-relabel preflow algorithm and our implementation calculates
     54  /// preflow push-relabel algorithm. Our implementation calculates
    5455  /// the minimum cut in \f$ O(n^2\sqrt{m}) \f$ time (we use the
    5556  /// highest-label rule), or in \f$O(nm)\f$ for unit capacities. The
    56   /// purpose of such algorithm is testing network reliability. For an
    57   /// undirected graph you can run just the first phase of the
    58   /// algorithm or you can use the algorithm of Nagamochi and Ibaraki
    59   /// which solves the undirected problem in
    60   /// \f$ O(nm + n^2 \log n) \f$ time: it is implemented in the
    61   /// NagamochiIbaraki algorithm class.
     57  /// purpose of such algorithm is e.g. testing network reliability.
    6258  ///
    63   /// \param GR The digraph class the algorithm runs on.
    64   /// \param CAP An arc map of capacities which can be any numreric type.
    65   /// The default type is \ref concepts::Digraph::ArcMap "GR::ArcMap<int>".
    66   /// \param TOL Tolerance class for handling inexact computations. The
     59  /// For an undirected graph you can run just the first phase of the
     60  /// algorithm or you can use the algorithm of Nagamochi and Ibaraki,
     61  /// which solves the undirected problem in \f$ O(nm + n^2 \log n) \f$
     62  /// time. It is implemented in the NagamochiIbaraki algorithm class.
     63  ///
     64  /// \tparam GR The type of the digraph the algorithm runs on.
     65  /// \tparam CAP The type of the arc map containing the capacities,
     66  /// which can be any numreric type. The default map type is
     67  /// \ref concepts::Digraph::ArcMap "GR::ArcMap<int>".
     68  /// \tparam TOL Tolerance class for handling inexact computations. The
    6769  /// default tolerance type is \ref Tolerance "Tolerance<CAP::Value>".
    6870#ifdef DOXYGEN
     
    7476#endif
    7577  class HaoOrlin {
     78  public:
     79   
     80    /// The digraph type of the algorithm
     81    typedef GR Digraph;
     82    /// The capacity map type of the algorithm
     83    typedef CAP CapacityMap;
     84    /// The tolerance type of the algorithm
     85    typedef TOL Tolerance;
     86
    7687  private:
    7788
    78     typedef GR Digraph;
    79     typedef CAP CapacityMap;
    80     typedef TOL Tolerance;
    81 
    8289    typedef typename CapacityMap::Value Value;
    8390
    84     TEMPLATE_GRAPH_TYPEDEFS(Digraph);
     91    TEMPLATE_DIGRAPH_TYPEDEFS(Digraph);
    8592
    8693    const Digraph& _graph;
     
    162169
    163170    void activate(const Node& i) {
    164       _active->set(i, true);
     171      (*_active)[i] = true;
    165172
    166173      int bucket = (*_bucket)[i];
     
    168175      if ((*_prev)[i] == INVALID || (*_active)[(*_prev)[i]]) return;
    169176      //unlace
    170       _next->set((*_prev)[i], (*_next)[i]);
     177      (*_next)[(*_prev)[i]] = (*_next)[i];
    171178      if ((*_next)[i] != INVALID) {
    172         _prev->set((*_next)[i], (*_prev)[i]);
     179        (*_prev)[(*_next)[i]] = (*_prev)[i];
    173180      } else {
    174181        _last[bucket] = (*_prev)[i];
    175182      }
    176183      //lace
    177       _next->set(i, _first[bucket]);
    178       _prev->set(_first[bucket], i);
    179       _prev->set(i, INVALID);
     184      (*_next)[i] = _first[bucket];
     185      (*_prev)[_first[bucket]] = i;
     186      (*_prev)[i] = INVALID;
    180187      _first[bucket] = i;
    181188    }
    182189
    183190    void deactivate(const Node& i) {
    184       _active->set(i, false);
     191      (*_active)[i] = false;
    185192      int bucket = (*_bucket)[i];
    186193
     
    188195
    189196      //unlace
    190       _prev->set((*_next)[i], (*_prev)[i]);
     197      (*_prev)[(*_next)[i]] = (*_prev)[i];
    191198      if ((*_prev)[i] != INVALID) {
    192         _next->set((*_prev)[i], (*_next)[i]);
     199        (*_next)[(*_prev)[i]] = (*_next)[i];
    193200      } else {
    194201        _first[bucket] = (*_next)[i];
    195202      }
    196203      //lace
    197       _prev->set(i, _last[bucket]);
    198       _next->set(_last[bucket], i);
    199       _next->set(i, INVALID);
     204      (*_prev)[i] = _last[bucket];
     205      (*_next)[_last[bucket]] = i;
     206      (*_next)[i] = INVALID;
    200207      _last[bucket] = i;
    201208    }
     
    204211      (*_bucket)[i] = bucket;
    205212      if (_last[bucket] != INVALID) {
    206         _prev->set(i, _last[bucket]);
    207         _next->set(_last[bucket], i);
    208         _next->set(i, INVALID);
     213        (*_prev)[i] = _last[bucket];
     214        (*_next)[_last[bucket]] = i;
     215        (*_next)[i] = INVALID;
    209216        _last[bucket] = i;
    210217      } else {
    211         _prev->set(i, INVALID);
     218        (*_prev)[i] = INVALID;
    212219        _first[bucket] = i;
    213         _next->set(i, INVALID);
     220        (*_next)[i] = INVALID;
    214221        _last[bucket] = i;
    215222      }
     
    219226
    220227      for (NodeIt n(_graph); n != INVALID; ++n) {
    221         _excess->set(n, 0);
     228        (*_excess)[n] = 0;
     229        (*_source_set)[n] = false;
    222230      }
    223231
    224232      for (ArcIt a(_graph); a != INVALID; ++a) {
    225         _flow->set(a, 0);
     233        (*_flow)[a] = 0;
    226234      }
    227235
     
    233241        typename Digraph::template NodeMap<bool> reached(_graph, false);
    234242
    235         reached.set(_source, true);
     243        reached[_source] = true;
    236244        bool first_set = true;
    237245
     
    241249
    242250          queue[qlast++] = t;
    243           reached.set(t, true);
     251          reached[t] = true;
    244252
    245253          while (qfirst != qlast) {
     
    258266              Node u = _graph.source(a);
    259267              if (!reached[u] && _tolerance.positive((*_capacity)[a])) {
    260                 reached.set(u, true);
     268                reached[u] = true;
    261269                queue[qlast++] = u;
    262270              }
     
    267275
    268276        ++bucket_num;
    269         _bucket->set(_source, 0);
     277        (*_bucket)[_source] = 0;
    270278        _dormant[0] = true;
    271279      }
    272       _source_set->set(_source, true);
     280      (*_source_set)[_source] = true;
    273281
    274282      Node target = _last[_sets.back().back()];
     
    277285          if (_tolerance.positive((*_capacity)[a])) {
    278286            Node u = _graph.target(a);
    279             _flow->set(a, (*_capacity)[a]);
    280             _excess->set(u, (*_excess)[u] + (*_capacity)[a]);
     287            (*_flow)[a] = (*_capacity)[a];
     288            (*_excess)[u] += (*_capacity)[a];
    281289            if (!(*_active)[u] && u != _source) {
    282290              activate(u);
     
    319327              }
    320328              if (!_tolerance.less(rem, excess)) {
    321                 _flow->set(a, (*_flow)[a] + excess);
    322                 _excess->set(v, (*_excess)[v] + excess);
     329                (*_flow)[a] += excess;
     330                (*_excess)[v] += excess;
    323331                excess = 0;
    324332                goto no_more_push;
    325333              } else {
    326334                excess -= rem;
    327                 _excess->set(v, (*_excess)[v] + rem);
    328                 _flow->set(a, (*_capacity)[a]);
     335                (*_excess)[v] += rem;
     336                (*_flow)[a] = (*_capacity)[a];
    329337              }
    330338            } else if (next_bucket > (*_bucket)[v]) {
     
    343351              }
    344352              if (!_tolerance.less(rem, excess)) {
    345                 _flow->set(a, (*_flow)[a] - excess);
    346                 _excess->set(v, (*_excess)[v] + excess);
     353                (*_flow)[a] -= excess;
     354                (*_excess)[v] += excess;
    347355                excess = 0;
    348356                goto no_more_push;
    349357              } else {
    350358                excess -= rem;
    351                 _excess->set(v, (*_excess)[v] + rem);
    352                 _flow->set(a, 0);
     359                (*_excess)[v] += rem;
     360                (*_flow)[a] = 0;
    353361              }
    354362            } else if (next_bucket > (*_bucket)[v]) {
     
    359367        no_more_push:
    360368
    361           _excess->set(n, excess);
     369          (*_excess)[n] = excess;
    362370
    363371          if (excess != 0) {
     
    377385            } else if (next_bucket == _node_num) {
    378386              _first[(*_bucket)[n]] = (*_next)[n];
    379               _prev->set((*_next)[n], INVALID);
     387              (*_prev)[(*_next)[n]] = INVALID;
    380388
    381389              std::list<std::list<int> >::iterator new_set =
     
    383391
    384392              new_set->push_front(bucket_num);
    385               _bucket->set(n, bucket_num);
     393              (*_bucket)[n] = bucket_num;
    386394              _first[bucket_num] = _last[bucket_num] = n;
    387               _next->set(n, INVALID);
    388               _prev->set(n, INVALID);
     395              (*_next)[n] = INVALID;
     396              (*_prev)[n] = INVALID;
    389397              _dormant[bucket_num] = true;
    390398              ++bucket_num;
     
    396404            } else {
    397405              _first[*_highest] = (*_next)[n];
    398               _prev->set((*_next)[n], INVALID);
     406              (*_prev)[(*_next)[n]] = INVALID;
    399407
    400408              while (next_bucket != *_highest) {
     
    410418              --_highest;
    411419
    412               _bucket->set(n, *_highest);
    413               _next->set(n, _first[*_highest]);
     420              (*_bucket)[n] = *_highest;
     421              (*_next)[n] = _first[*_highest];
    414422              if (_first[*_highest] != INVALID) {
    415                 _prev->set(_first[*_highest], n);
     423                (*_prev)[_first[*_highest]] = n;
    416424              } else {
    417425                _last[*_highest] = n;
     
    435443          _min_cut = (*_excess)[target];
    436444          for (NodeIt i(_graph); i != INVALID; ++i) {
    437             _min_cut_map->set(i, true);
     445            (*_min_cut_map)[i] = true;
    438446          }
    439447          for (std::list<int>::iterator it = _sets.back().begin();
     
    441449            Node n = _first[*it];
    442450            while (n != INVALID) {
    443               _min_cut_map->set(n, false);
     451              (*_min_cut_map)[n] = false;
    444452              n = (*_next)[n];
    445453            }
     
    454462              new_target = (*_prev)[target];
    455463            } else {
    456               _prev->set((*_next)[target], (*_prev)[target]);
     464              (*_prev)[(*_next)[target]] = (*_prev)[target];
    457465              new_target = (*_next)[target];
    458466            }
     
    460468              _first[(*_bucket)[target]] = (*_next)[target];
    461469            } else {
    462               _next->set((*_prev)[target], (*_next)[target]);
     470              (*_next)[(*_prev)[target]] = (*_next)[target];
    463471            }
    464472          } else {
     
    476484          }
    477485
    478           _bucket->set(target, 0);
    479 
    480           _source_set->set(target, true);
     486          (*_bucket)[target] = 0;
     487
     488          (*_source_set)[target] = true;
    481489          for (OutArcIt a(_graph, target); a != INVALID; ++a) {
    482490            Value rem = (*_capacity)[a] - (*_flow)[a];
     
    486494              activate(v);
    487495            }
    488             _excess->set(v, (*_excess)[v] + rem);
    489             _flow->set(a, (*_capacity)[a]);
     496            (*_excess)[v] += rem;
     497            (*_flow)[a] = (*_capacity)[a];
    490498          }
    491499
     
    497505              activate(v);
    498506            }
    499             _excess->set(v, (*_excess)[v] + rem);
    500             _flow->set(a, 0);
     507            (*_excess)[v] += rem;
     508            (*_flow)[a] = 0;
    501509          }
    502510
     
    518526
    519527      for (NodeIt n(_graph); n != INVALID; ++n) {
    520         _excess->set(n, 0);
     528        (*_excess)[n] = 0;
     529        (*_source_set)[n] = false;
    521530      }
    522531
    523532      for (ArcIt a(_graph); a != INVALID; ++a) {
    524         _flow->set(a, 0);
     533        (*_flow)[a] = 0;
    525534      }
    526535
     
    532541        typename Digraph::template NodeMap<bool> reached(_graph, false);
    533542
    534         reached.set(_source, true);
     543        reached[_source] = true;
    535544
    536545        bool first_set = true;
     
    541550
    542551          queue[qlast++] = t;
    543           reached.set(t, true);
     552          reached[t] = true;
    544553
    545554          while (qfirst != qlast) {
     
    558567              Node u = _graph.target(a);
    559568              if (!reached[u] && _tolerance.positive((*_capacity)[a])) {
    560                 reached.set(u, true);
     569                reached[u] = true;
    561570                queue[qlast++] = u;
    562571              }
     
    567576
    568577        ++bucket_num;
    569         _bucket->set(_source, 0);
     578        (*_bucket)[_source] = 0;
    570579        _dormant[0] = true;
    571580      }
    572       _source_set->set(_source, true);
     581      (*_source_set)[_source] = true;
    573582
    574583      Node target = _last[_sets.back().back()];
     
    577586          if (_tolerance.positive((*_capacity)[a])) {
    578587            Node u = _graph.source(a);
    579             _flow->set(a, (*_capacity)[a]);
    580             _excess->set(u, (*_excess)[u] + (*_capacity)[a]);
     588            (*_flow)[a] = (*_capacity)[a];
     589            (*_excess)[u] += (*_capacity)[a];
    581590            if (!(*_active)[u] && u != _source) {
    582591              activate(u);
     
    619628              }
    620629              if (!_tolerance.less(rem, excess)) {
    621                 _flow->set(a, (*_flow)[a] + excess);
    622                 _excess->set(v, (*_excess)[v] + excess);
     630                (*_flow)[a] += excess;
     631                (*_excess)[v] += excess;
    623632                excess = 0;
    624633                goto no_more_push;
    625634              } else {
    626635                excess -= rem;
    627                 _excess->set(v, (*_excess)[v] + rem);
    628                 _flow->set(a, (*_capacity)[a]);
     636                (*_excess)[v] += rem;
     637                (*_flow)[a] = (*_capacity)[a];
    629638              }
    630639            } else if (next_bucket > (*_bucket)[v]) {
     
    643652              }
    644653              if (!_tolerance.less(rem, excess)) {
    645                 _flow->set(a, (*_flow)[a] - excess);
    646                 _excess->set(v, (*_excess)[v] + excess);
     654                (*_flow)[a] -= excess;
     655                (*_excess)[v] += excess;
    647656                excess = 0;
    648657                goto no_more_push;
    649658              } else {
    650659                excess -= rem;
    651                 _excess->set(v, (*_excess)[v] + rem);
    652                 _flow->set(a, 0);
     660                (*_excess)[v] += rem;
     661                (*_flow)[a] = 0;
    653662              }
    654663            } else if (next_bucket > (*_bucket)[v]) {
     
    659668        no_more_push:
    660669
    661           _excess->set(n, excess);
     670          (*_excess)[n] = excess;
    662671
    663672          if (excess != 0) {
     
    677686            } else if (next_bucket == _node_num) {
    678687              _first[(*_bucket)[n]] = (*_next)[n];
    679               _prev->set((*_next)[n], INVALID);
     688              (*_prev)[(*_next)[n]] = INVALID;
    680689
    681690              std::list<std::list<int> >::iterator new_set =
     
    683692
    684693              new_set->push_front(bucket_num);
    685               _bucket->set(n, bucket_num);
     694              (*_bucket)[n] = bucket_num;
    686695              _first[bucket_num] = _last[bucket_num] = n;
    687               _next->set(n, INVALID);
    688               _prev->set(n, INVALID);
     696              (*_next)[n] = INVALID;
     697              (*_prev)[n] = INVALID;
    689698              _dormant[bucket_num] = true;
    690699              ++bucket_num;
     
    696705            } else {
    697706              _first[*_highest] = (*_next)[n];
    698               _prev->set((*_next)[n], INVALID);
     707              (*_prev)[(*_next)[n]] = INVALID;
    699708
    700709              while (next_bucket != *_highest) {
     
    709718              --_highest;
    710719
    711               _bucket->set(n, *_highest);
    712               _next->set(n, _first[*_highest]);
     720              (*_bucket)[n] = *_highest;
     721              (*_next)[n] = _first[*_highest];
    713722              if (_first[*_highest] != INVALID) {
    714                 _prev->set(_first[*_highest], n);
     723                (*_prev)[_first[*_highest]] = n;
    715724              } else {
    716725                _last[*_highest] = n;
     
    734743          _min_cut = (*_excess)[target];
    735744          for (NodeIt i(_graph); i != INVALID; ++i) {
    736             _min_cut_map->set(i, false);
     745            (*_min_cut_map)[i] = false;
    737746          }
    738747          for (std::list<int>::iterator it = _sets.back().begin();
     
    740749            Node n = _first[*it];
    741750            while (n != INVALID) {
    742               _min_cut_map->set(n, true);
     751              (*_min_cut_map)[n] = true;
    743752              n = (*_next)[n];
    744753            }
     
    753762              new_target = (*_prev)[target];
    754763            } else {
    755               _prev->set((*_next)[target], (*_prev)[target]);
     764              (*_prev)[(*_next)[target]] = (*_prev)[target];
    756765              new_target = (*_next)[target];
    757766            }
     
    759768              _first[(*_bucket)[target]] = (*_next)[target];
    760769            } else {
    761               _next->set((*_prev)[target], (*_next)[target]);
     770              (*_next)[(*_prev)[target]] = (*_next)[target];
    762771            }
    763772          } else {
     
    775784          }
    776785
    777           _bucket->set(target, 0);
    778 
    779           _source_set->set(target, true);
     786          (*_bucket)[target] = 0;
     787
     788          (*_source_set)[target] = true;
    780789          for (InArcIt a(_graph, target); a != INVALID; ++a) {
    781790            Value rem = (*_capacity)[a] - (*_flow)[a];
     
    785794              activate(v);
    786795            }
    787             _excess->set(v, (*_excess)[v] + rem);
    788             _flow->set(a, (*_capacity)[a]);
     796            (*_excess)[v] += rem;
     797            (*_flow)[a] = (*_capacity)[a];
    789798          }
    790799
     
    796805              activate(v);
    797806            }
    798             _excess->set(v, (*_excess)[v] + rem);
    799             _flow->set(a, 0);
     807            (*_excess)[v] += rem;
     808            (*_flow)[a] = 0;
    800809          }
    801810
     
    816825  public:
    817826
    818     /// \name Execution control
     827    /// \name Execution Control
    819828    /// The simplest way to execute the algorithm is to use
    820829    /// one of the member functions called \ref run().
    821830    /// \n
    822     /// If you need more control on the execution,
    823     /// first you must call \ref init(), then the \ref calculateIn() or
    824     /// \ref calculateOut() functions.
     831    /// If you need better control on the execution,
     832    /// you have to call one of the \ref init() functions first, then
     833    /// \ref calculateOut() and/or \ref calculateIn().
    825834
    826835    /// @{
    827836
    828     /// \brief Initializes the internal data structures.
    829     ///
    830     /// Initializes the internal data structures. It creates
    831     /// the maps, residual graph adaptors and some bucket structures
    832     /// for the algorithm.
     837    /// \brief Initialize the internal data structures.
     838    ///
     839    /// This function initializes the internal data structures. It creates
     840    /// the maps and some bucket structures for the algorithm.
     841    /// The first node is used as the source node for the push-relabel
     842    /// algorithm.
    833843    void init() {
    834844      init(NodeIt(_graph));
    835845    }
    836846
    837     /// \brief Initializes the internal data structures.
    838     ///
    839     /// Initializes the internal data structures. It creates
    840     /// the maps, residual graph adaptor and some bucket structures
    841     /// for the algorithm. Node \c source  is used as the push-relabel
    842     /// algorithm's source.
     847    /// \brief Initialize the internal data structures.
     848    ///
     849    /// This function initializes the internal data structures. It creates
     850    /// the maps and some bucket structures for the algorithm.
     851    /// The given node is used as the source node for the push-relabel
     852    /// algorithm.
    843853    void init(const Node& source) {
    844854      _source = source;
     
    880890
    881891
    882     /// \brief Calculates a minimum cut with \f$ source \f$ on the
     892    /// \brief Calculate a minimum cut with \f$ source \f$ on the
    883893    /// source-side.
    884894    ///
    885     /// Calculates a minimum cut with \f$ source \f$ on the
     895    /// This function calculates a minimum cut with \f$ source \f$ on the
    886896    /// source-side (i.e. a set \f$ X\subsetneq V \f$ with
    887     /// \f$ source \in X \f$ and minimal out-degree).
     897    /// \f$ source \in X \f$ and minimal outgoing capacity).
     898    ///
     899    /// \pre \ref init() must be called before using this function.
    888900    void calculateOut() {
    889901      findMinCutOut();
    890902    }
    891903
    892     /// \brief Calculates a minimum cut with \f$ source \f$ on the
    893     /// target-side.
    894     ///
    895     /// Calculates a minimum cut with \f$ source \f$ on the
    896     /// target-side (i.e. a set \f$ X\subsetneq V \f$ with
    897     /// \f$ source \in X \f$ and minimal out-degree).
     904    /// \brief Calculate a minimum cut with \f$ source \f$ on the
     905    /// sink-side.
     906    ///
     907    /// This function calculates a minimum cut with \f$ source \f$ on the
     908    /// sink-side (i.e. a set \f$ X\subsetneq V \f$ with
     909    /// \f$ source \notin X \f$ and minimal outgoing capacity).
     910    ///
     911    /// \pre \ref init() must be called before using this function.
    898912    void calculateIn() {
    899913      findMinCutIn();
     
    901915
    902916
    903     /// \brief Runs the algorithm.
    904     ///
    905     /// Runs the algorithm. It finds nodes \c source and \c target
    906     /// arbitrarily and then calls \ref init(), \ref calculateOut()
     917    /// \brief Run the algorithm.
     918    ///
     919    /// This function runs the algorithm. It finds nodes \c source and
     920    /// \c target arbitrarily and then calls \ref init(), \ref calculateOut()
    907921    /// and \ref calculateIn().
    908922    void run() {
     
    912926    }
    913927
    914     /// \brief Runs the algorithm.
    915     ///
    916     /// Runs the algorithm. It uses the given \c source node, finds a
    917     /// proper \c target and then calls the \ref init(), \ref
    918     /// calculateOut() and \ref calculateIn().
     928    /// \brief Run the algorithm.
     929    ///
     930    /// This function runs the algorithm. It uses the given \c source node,
     931    /// finds a proper \c target node and then calls the \ref init(),
     932    /// \ref calculateOut() and \ref calculateIn().
    919933    void run(const Node& s) {
    920934      init(s);
     
    927941    /// \name Query Functions
    928942    /// The result of the %HaoOrlin algorithm
    929     /// can be obtained using these functions.
    930     /// \n
    931     /// Before using these functions, either \ref run(), \ref
    932     /// calculateOut() or \ref calculateIn() must be called.
     943    /// can be obtained using these functions.\n
     944    /// \ref run(), \ref calculateOut() or \ref calculateIn()
     945    /// should be called before using them.
    933946
    934947    /// @{
    935948
    936     /// \brief Returns the value of the minimum value cut.
    937     ///
    938     /// Returns the value of the minimum value cut.
     949    /// \brief Return the value of the minimum cut.
     950    ///
     951    /// This function returns the value of the minimum cut.
     952    ///
     953    /// \pre \ref run(), \ref calculateOut() or \ref calculateIn()
     954    /// must be called before using this function.
    939955    Value minCutValue() const {
    940956      return _min_cut;
     
    942958
    943959
    944     /// \brief Returns a minimum cut.
    945     ///
    946     /// Sets \c nodeMap to the characteristic vector of a minimum
    947     /// value cut: it will give a nonempty set \f$ X\subsetneq V \f$
    948     /// with minimal out-degree (i.e. \c nodeMap will be true exactly
    949     /// for the nodes of \f$ X \f$).  \pre nodeMap should be a
    950     /// bool-valued node-map.
    951     template <typename NodeMap>
    952     Value minCutMap(NodeMap& nodeMap) const {
     960    /// \brief Return a minimum cut.
     961    ///
     962    /// This function sets \c cutMap to the characteristic vector of a
     963    /// minimum value cut: it will give a non-empty set \f$ X\subsetneq V \f$
     964    /// with minimal outgoing capacity (i.e. \c cutMap will be \c true exactly
     965    /// for the nodes of \f$ X \f$).
     966    ///
     967    /// \param cutMap A \ref concepts::WriteMap "writable" node map with
     968    /// \c bool (or convertible) value type.
     969    ///
     970    /// \return The value of the minimum cut.
     971    ///
     972    /// \pre \ref run(), \ref calculateOut() or \ref calculateIn()
     973    /// must be called before using this function.
     974    template <typename CutMap>
     975    Value minCutMap(CutMap& cutMap) const {
    953976      for (NodeIt it(_graph); it != INVALID; ++it) {
    954         nodeMap.set(it, (*_min_cut_map)[it]);
     977        cutMap.set(it, (*_min_cut_map)[it]);
    955978      }
    956979      return _min_cut;
     
    961984  }; //class HaoOrlin
    962985
    963 
    964986} //namespace lemon
    965987
  • lemon/hypercube_graph.h

    r559 r582  
    293293  ///
    294294  /// This graph type fully conforms to the \ref concepts::Graph
    295   /// "Graph" concept, and it also has an important extra feature
    296   /// that its maps are real \ref concepts::ReferenceMap
    297   /// "reference map"s.
     295  /// "Graph concept".
    298296  class HypercubeGraph : public ExtendedHypercubeGraphBase {
    299297  public:
  • lemon/kruskal.h

    r440 r584  
    249249  /// \ingroup spantree
    250250  ///
    251   /// \brief Kruskal algorithm to find a minimum cost spanning tree of
     251  /// \brief Kruskal's algorithm for finding a minimum cost spanning tree of
    252252  /// a graph.
    253253  ///
    254254  /// This function runs Kruskal's algorithm to find a minimum cost
    255   /// spanning tree.
     255  /// spanning tree of a graph.
    256256  /// Due to some C++ hacking, it accepts various input and output types.
    257257  ///
     
    265265  /// It can be one of the following choices.
    266266  /// - An STL compatible 'Forward Container' with
    267   /// <tt>std::pair<GR::Arc,X></tt> or
    268   /// <tt>std::pair<GR::Edge,X></tt> as its <tt>value_type</tt>, where
    269   /// \c X is the type of the costs. The pairs indicates the arcs/edges
     267  /// <tt>std::pair<GR::Arc,C></tt> or
     268  /// <tt>std::pair<GR::Edge,C></tt> as its <tt>value_type</tt>, where
     269  /// \c C is the type of the costs. The pairs indicates the arcs/edges
    270270  /// along with the assigned cost. <em>They must be in a
    271271  /// cost-ascending order.</em>
     
    274274  ///
    275275  /// \retval out Here we also have a choice.
    276   /// - It can be a writable \c bool arc/edge map. After running the
    277   /// algorithm it will contain the found minimum cost spanning
     276  /// - It can be a writable arc/edge map with \c bool value type. After
     277  /// running the algorithm it will contain the found minimum cost spanning
    278278  /// tree: the value of an arc/edge will be set to \c true if it belongs
    279279  /// to the tree, otherwise it will be set to \c false. The value of
     
    302302
    303303#ifdef DOXYGEN
    304   template <class Graph, class In, class Out>
    305   Value kruskal(GR const& g, const In& in, Out& out)
     304  template <typename Graph, typename In, typename Out>
     305  Value kruskal(const Graph& g, const In& in, Out& out)
    306306#else
    307307  template <class Graph, class In, class Out>
     
    315315
    316316
    317 
    318 
    319317  template <class Graph, class In, class Out>
    320318  inline typename _kruskal_bits::KruskalValueSelector<In>::Value
  • lemon/lgf_reader.h

    r598 r599  
    593593  public:
    594594
    595     /// \name Reading rules
     595    /// \name Reading Rules
    596596    /// @{
    597597
     
    698698    /// @}
    699699
    700     /// \name Select section by name
     700    /// \name Select Section by Name
    701701    /// @{
    702702
     
    727727    /// @}
    728728
    729     /// \name Using previously constructed node or arc set
     729    /// \name Using Previously Constructed Node or Arc Set
    730730    /// @{
    731731
     
    11161116  public:
    11171117
    1118     /// \name Execution of the reader
     1118    /// \name Execution of the Reader
    11191119    /// @{
    11201120
     
    14161416  public:
    14171417
    1418     /// \name Reading rules
     1418    /// \name Reading Rules
    14191419    /// @{
    14201420
     
    15671567    /// @}
    15681568
    1569     /// \name Select section by name
     1569    /// \name Select Section by Name
    15701570    /// @{
    15711571
     
    15961596    /// @}
    15971597
    1598     /// \name Using previously constructed node or edge set
     1598    /// \name Using Previously Constructed Node or Edge Set
    15991599    /// @{
    16001600
     
    19861986  public:
    19871987
    1988     /// \name Execution of the reader
     1988    /// \name Execution of the Reader
    19891989    /// @{
    19901990
     
    22102210  public:
    22112211
    2212     /// \name Section readers
     2212    /// \name Section Readers
    22132213    /// @{
    22142214
     
    23092309
    23102310
    2311     /// \name Execution of the reader
     2311    /// \name Execution of the Reader
    23122312    /// @{
    23132313
     
    25012501
    25022502
    2503     /// \name Node sections
     2503    /// \name Node Sections
    25042504    /// @{
    25052505
     
    25272527    /// @}
    25282528
    2529     /// \name Arc/Edge sections
     2529    /// \name Arc/Edge Sections
    25302530    /// @{
    25312531
     
    25852585    /// @}
    25862586
    2587     /// \name Attribute sections
     2587    /// \name Attribute Sections
    25882588    /// @{
    25892589
     
    26112611    /// @}
    26122612
    2613     /// \name Extra sections
     2613    /// \name Extra Sections
    26142614    /// @{
    26152615
     
    26872687  public:
    26882688
    2689     /// \name Execution of the contents reader
     2689    /// \name Execution of the Contents Reader
    26902690    /// @{
    26912691
  • lemon/lgf_writer.h

    r598 r599  
    537537  public:
    538538
    539     /// \name Writing rules
     539    /// \name Writing Rules
    540540    /// @{
    541541
     
    640640    }
    641641
    642     /// \name Section captions
     642    /// \name Section Captions
    643643    /// @{
    644644
     
    667667    }
    668668
    669     /// \name Skipping section
     669    /// \name Skipping Section
    670670    /// @{
    671671
     
    884884  public:
    885885
    886     /// \name Execution of the writer
     886    /// \name Execution of the Writer
    887887    /// @{
    888888
     
    11301130  public:
    11311131
    1132     /// \name Writing rules
     1132    /// \name Writing Rules
    11331133    /// @{
    11341134
     
    12791279    }
    12801280
    1281     /// \name Section captions
     1281    /// \name Section Captions
    12821282    /// @{
    12831283
     
    13061306    }
    13071307
    1308     /// \name Skipping section
     1308    /// \name Skipping Section
    13091309    /// @{
    13101310
     
    15231523  public:
    15241524
    1525     /// \name Execution of the writer
     1525    /// \name Execution of the Writer
    15261526    /// @{
    15271527
     
    17001700  public:
    17011701
    1702     /// \name Section writers
     1702    /// \name Section Writers
    17031703    /// @{
    17041704
     
    17671767
    17681768
    1769     /// \name Execution of the writer
     1769    /// \name Execution of the Writer
    17701770    /// @{
    17711771
  • lemon/list_graph.h

    r559 r582  
    321321  ///only in the concept class.
    322322  ///
    323   ///An important extra feature of this digraph implementation is that
    324   ///its maps are real \ref concepts::ReferenceMap "reference map"s.
    325   ///
    326323  ///\sa concepts::Digraph
    327324
     
    11771174  ///only in the concept class.
    11781175  ///
    1179   ///An important extra feature of this graph implementation is that
    1180   ///its maps are real \ref concepts::ReferenceMap "reference map"s.
    1181   ///
    11821176  ///\sa concepts::Graph
    11831177
  • lemon/lp_base.h

    r540 r584  
    5353    ///Possible outcomes of an LP solving procedure
    5454    enum SolveExitStatus {
    55       ///This means that the problem has been successfully solved: either
     55      /// = 0. It means that the problem has been successfully solved: either
    5656      ///an optimal solution has been found or infeasibility/unboundedness
    5757      ///has been proved.
    5858      SOLVED = 0,
    59       ///Any other case (including the case when some user specified
    60       ///limit has been exceeded)
     59      /// = 1. Any other case (including the case when some user specified
     60      ///limit has been exceeded).
    6161      UNSOLVED = 1
    6262    };
     
    6969      MAX
    7070    };
     71
     72    ///Enum for \c messageLevel() parameter
     73    enum MessageLevel {
     74      /// No output (default value).
     75      MESSAGE_NOTHING,
     76      /// Error messages only.
     77      MESSAGE_ERROR,
     78      /// Warnings.
     79      MESSAGE_WARNING,
     80      /// Normal output.
     81      MESSAGE_NORMAL,
     82      /// Verbose output.
     83      MESSAGE_VERBOSE
     84    };
     85   
    7186
    7287    ///The floating point type used by the solver
     
    974989    virtual const char* _solverName() const = 0;
    975990
     991    virtual void _messageLevel(MessageLevel level) = 0;
     992
    976993    //Own protected stuff
    977994
     
    9891006    const char* solverName() const {return _solverName();}
    9901007
    991     ///\name Build up and modify the LP
     1008    ///\name Build Up and Modify the LP
    9921009
    9931010    ///@{
     
    15281545    void clear() { _clear(); }
    15291546
     1547    /// Sets the message level of the solver
     1548    void messageLevel(MessageLevel level) { _messageLevel(level); }
     1549
    15301550    ///@}
    15311551
     
    17691789    /// The problem types for primal and dual problems
    17701790    enum ProblemType {
    1771       ///Feasible solution hasn't been found (but may exist).
     1791      /// = 0. Feasible solution hasn't been found (but may exist).
    17721792      UNDEFINED = 0,
    1773       ///The problem has no feasible solution
     1793      /// = 1. The problem has no feasible solution.
    17741794      INFEASIBLE = 1,
    1775       ///Feasible solution found
     1795      /// = 2. Feasible solution found.
    17761796      FEASIBLE = 2,
    1777       ///Optimal solution exists and found
     1797      /// = 3. Optimal solution exists and found.
    17781798      OPTIMAL = 3,
    1779       ///The cost function is unbounded
     1799      /// = 4. The cost function is unbounded.
    17801800      UNBOUNDED = 4
    17811801    };
     
    18331853    ///@}
    18341854
    1835     ///\name Obtain the solution
     1855    ///\name Obtain the Solution
    18361856
    18371857    ///@{
     
    19551975    /// The problem types for MIP problems
    19561976    enum ProblemType {
    1957       ///Feasible solution hasn't been found (but may exist).
     1977      /// = 0. Feasible solution hasn't been found (but may exist).
    19581978      UNDEFINED = 0,
    1959       ///The problem has no feasible solution
     1979      /// = 1. The problem has no feasible solution.
    19601980      INFEASIBLE = 1,
    1961       ///Feasible solution found
     1981      /// = 2. Feasible solution found.
    19621982      FEASIBLE = 2,
    1963       ///Optimal solution exists and found
     1983      /// = 3. Optimal solution exists and found.
    19641984      OPTIMAL = 3,
    1965       ///The cost function is unbounded
    1966       ///
    1967       ///The Mip or at least the relaxed problem is unbounded
     1985      /// = 4. The cost function is unbounded.
     1986      ///The Mip or at least the relaxed problem is unbounded.
    19681987      UNBOUNDED = 4
    19691988    };
     
    19872006    ///@}
    19882007
    1989     ///\name Setting column type
     2008    ///\name Set Column Type
    19902009    ///@{
    19912010
    19922011    ///Possible variable (column) types (e.g. real, integer, binary etc.)
    19932012    enum ColTypes {
    1994       ///Continuous variable (default)
     2013      /// = 0. Continuous variable (default).
    19952014      REAL = 0,
    1996       ///Integer variable
     2015      /// = 1. Integer variable.
    19972016      INTEGER = 1
    19982017    };
     
    20152034    ///@}
    20162035
    2017     ///\name Obtain the solution
     2036    ///\name Obtain the Solution
    20182037
    20192038    ///@{
  • lemon/lp_skeleton.cc

    r540 r576  
    8585  }
    8686
     87  void SkeletonSolverBase::_messageLevel(MessageLevel) {}
     88
    8789  LpSkeleton::SolveExitStatus LpSkeleton::_solve() { return SOLVED; }
    8890
  • lemon/lp_skeleton.h

    r541 r576  
    141141    virtual void _clear();
    142142
     143    ///\e
     144    virtual void _messageLevel(MessageLevel);
    143145  };
    144146
  • lemon/maps.h

    r572 r584  
    27292729  /// \brief Potential difference map
    27302730  ///
    2731   /// PotentialMap returns the difference between the potentials of the
    2732   /// source and target nodes of each arc in a digraph, i.e. it returns
     2731  /// PotentialDifferenceMap returns the difference between the potentials of
     2732  /// the source and target nodes of each arc in a digraph, i.e. it returns
    27332733  /// \code
    27342734  ///   potential[gr.target(arc)] - potential[gr.source(arc)].
  • lemon/max_matching.h

    r559 r581  
    283283
    284284        while (base != nca) {
    285           _ear->set(node, arc);
     285          (*_ear)[node] = arc;
    286286
    287287          Node n = node;
     
    290290            Arc a = (*_ear)[n];
    291291            n = _graph.target(a);
    292             _ear->set(n, _graph.oppositeArc(a));
     292            (*_ear)[n] = _graph.oppositeArc(a);
    293293          }
    294294          node = _graph.target((*_matching)[base]);
     
    296296          _tree_set->erase(node);
    297297          _blossom_set->insert(node, _blossom_set->find(base));
    298           _status->set(node, EVEN);
     298          (*_status)[node] = EVEN;
    299299          _node_queue[_last++] = node;
    300300          arc = _graph.oppositeArc((*_ear)[node]);
     
    305305      }
    306306
    307       _blossom_rep->set(_blossom_set->find(nca), nca);
     307      (*_blossom_rep)[_blossom_set->find(nca)] = nca;
    308308
    309309      {
     
    314314
    315315        while (base != nca) {
    316           _ear->set(node, arc);
     316          (*_ear)[node] = arc;
    317317
    318318          Node n = node;
     
    321321            Arc a = (*_ear)[n];
    322322            n = _graph.target(a);
    323             _ear->set(n, _graph.oppositeArc(a));
     323            (*_ear)[n] = _graph.oppositeArc(a);
    324324          }
    325325          node = _graph.target((*_matching)[base]);
     
    327327          _tree_set->erase(node);
    328328          _blossom_set->insert(node, _blossom_set->find(base));
    329           _status->set(node, EVEN);
     329          (*_status)[node] = EVEN;
    330330          _node_queue[_last++] = node;
    331331          arc = _graph.oppositeArc((*_ear)[node]);
     
    336336      }
    337337
    338       _blossom_rep->set(_blossom_set->find(nca), nca);
     338      (*_blossom_rep)[_blossom_set->find(nca)] = nca;
    339339    }
    340340
     
    345345      Node odd = _graph.target(a);
    346346
    347       _ear->set(odd, _graph.oppositeArc(a));
     347      (*_ear)[odd] = _graph.oppositeArc(a);
    348348      Node even = _graph.target((*_matching)[odd]);
    349       _blossom_rep->set(_blossom_set->insert(even), even);
    350       _status->set(odd, ODD);
    351       _status->set(even, EVEN);
     349      (*_blossom_rep)[_blossom_set->insert(even)] = even;
     350      (*_status)[odd] = ODD;
     351      (*_status)[even] = EVEN;
    352352      int tree = _tree_set->find((*_blossom_rep)[_blossom_set->find(base)]);
    353353      _tree_set->insert(odd, tree);
     
    363363      int tree = _tree_set->find((*_blossom_rep)[_blossom_set->find(even)]);
    364364
    365       _matching->set(odd, _graph.oppositeArc(a));
    366       _status->set(odd, MATCHED);
     365      (*_matching)[odd] = _graph.oppositeArc(a);
     366      (*_status)[odd] = MATCHED;
    367367
    368368      Arc arc = (*_matching)[even];
    369       _matching->set(even, a);
     369      (*_matching)[even] = a;
    370370
    371371      while (arc != INVALID) {
     
    373373        arc = (*_ear)[odd];
    374374        even = _graph.target(arc);
    375         _matching->set(odd, arc);
     375        (*_matching)[odd] = arc;
    376376        arc = (*_matching)[even];
    377         _matching->set(even, _graph.oppositeArc((*_matching)[odd]));
     377        (*_matching)[even] = _graph.oppositeArc((*_matching)[odd]);
    378378      }
    379379
     
    381381           it != INVALID; ++it) {
    382382        if ((*_status)[it] == ODD) {
    383           _status->set(it, MATCHED);
     383          (*_status)[it] = MATCHED;
    384384        } else {
    385385          int blossom = _blossom_set->find(it);
    386386          for (typename BlossomSet::ItemIt jt(*_blossom_set, blossom);
    387387               jt != INVALID; ++jt) {
    388             _status->set(jt, MATCHED);
     388            (*_status)[jt] = MATCHED;
    389389          }
    390390          _blossom_set->eraseClass(blossom);
     
    428428      createStructures();
    429429      for(NodeIt n(_graph); n != INVALID; ++n) {
    430         _matching->set(n, INVALID);
    431         _status->set(n, UNMATCHED);
     430        (*_matching)[n] = INVALID;
     431        (*_status)[n] = UNMATCHED;
    432432      }
    433433    }
     
    439439      createStructures();
    440440      for (NodeIt n(_graph); n != INVALID; ++n) {
    441         _matching->set(n, INVALID);
    442         _status->set(n, UNMATCHED);
     441        (*_matching)[n] = INVALID;
     442        (*_status)[n] = UNMATCHED;
    443443      }
    444444      for (NodeIt n(_graph); n != INVALID; ++n) {
     
    447447            Node v = _graph.target(a);
    448448            if ((*_matching)[v] == INVALID && v != n) {
    449               _matching->set(n, a);
    450               _status->set(n, MATCHED);
    451               _matching->set(v, _graph.oppositeArc(a));
    452               _status->set(v, MATCHED);
     449              (*_matching)[n] = a;
     450              (*_status)[n] = MATCHED;
     451              (*_matching)[v] = _graph.oppositeArc(a);
     452              (*_status)[v] = MATCHED;
    453453              break;
    454454            }
     
    470470
    471471      for (NodeIt n(_graph); n != INVALID; ++n) {
    472         _matching->set(n, INVALID);
    473         _status->set(n, UNMATCHED);
     472        (*_matching)[n] = INVALID;
     473        (*_status)[n] = UNMATCHED;
    474474      }
    475475      for(EdgeIt e(_graph); e!=INVALID; ++e) {
     
    478478          Node u = _graph.u(e);
    479479          if ((*_matching)[u] != INVALID) return false;
    480           _matching->set(u, _graph.direct(e, true));
    481           _status->set(u, MATCHED);
     480          (*_matching)[u] = _graph.direct(e, true);
     481          (*_status)[u] = MATCHED;
    482482
    483483          Node v = _graph.v(e);
    484484          if ((*_matching)[v] != INVALID) return false;
    485           _matching->set(v, _graph.direct(e, false));
    486           _status->set(v, MATCHED);
     485          (*_matching)[v] = _graph.direct(e, false);
     486          (*_status)[v] = MATCHED;
    487487        }
    488488      }
     
    498498          (*_blossom_rep)[_blossom_set->insert(n)] = n;
    499499          _tree_set->insert(n);
    500           _status->set(n, EVEN);
     500          (*_status)[n] = EVEN;
    501501          processSparse(n);
    502502        }
     
    513513          (*_blossom_rep)[_blossom_set->insert(n)] = n;
    514514          _tree_set->insert(n);
    515           _status->set(n, EVEN);
     515          (*_status)[n] = EVEN;
    516516          processDense(n);
    517517        }
     
    15491549        Value pot = (*_node_data)[bi].pot;
    15501550
    1551         _matching->set(base, matching);
     1551        (*_matching)[base] = matching;
    15521552        _blossom_node_list.push_back(base);
    1553         _node_potential->set(base, pot);
     1553        (*_node_potential)[base] = pot;
    15541554      } else {
    15551555
     
    16451645
    16461646      for (ArcIt e(_graph); e != INVALID; ++e) {
    1647         _node_heap_index->set(e, BinHeap<Value, IntArcMap>::PRE_HEAP);
     1647        (*_node_heap_index)[e] = BinHeap<Value, IntArcMap>::PRE_HEAP;
    16481648      }
    16491649      for (NodeIt n(_graph); n != INVALID; ++n) {
    1650         _delta1_index->set(n, _delta1->PRE_HEAP);
     1650        (*_delta1_index)[n] = _delta1->PRE_HEAP;
    16511651      }
    16521652      for (EdgeIt e(_graph); e != INVALID; ++e) {
    1653         _delta3_index->set(e, _delta3->PRE_HEAP);
     1653        (*_delta3_index)[e] = _delta3->PRE_HEAP;
    16541654      }
    16551655      for (int i = 0; i < _blossom_num; ++i) {
    1656         _delta2_index->set(i, _delta2->PRE_HEAP);
    1657         _delta4_index->set(i, _delta4->PRE_HEAP);
     1656        (*_delta2_index)[i] = _delta2->PRE_HEAP;
     1657        (*_delta4_index)[i] = _delta4->PRE_HEAP;
    16581658      }
    16591659
     
    16671667          }
    16681668        }
    1669         _node_index->set(n, index);
     1669        (*_node_index)[n] = index;
    16701670        (*_node_data)[index].pot = max;
    16711671        _delta1->push(n, max);
     
    27422742        Value pot = (*_node_data)[bi].pot;
    27432743
    2744         _matching->set(base, matching);
     2744        (*_matching)[base] = matching;
    27452745        _blossom_node_list.push_back(base);
    2746         _node_potential->set(base, pot);
     2746        (*_node_potential)[base] = pot;
    27472747      } else {
    27482748
     
    28322832
    28332833      for (ArcIt e(_graph); e != INVALID; ++e) {
    2834         _node_heap_index->set(e, BinHeap<Value, IntArcMap>::PRE_HEAP);
     2834        (*_node_heap_index)[e] = BinHeap<Value, IntArcMap>::PRE_HEAP;
    28352835      }
    28362836      for (EdgeIt e(_graph); e != INVALID; ++e) {
    2837         _delta3_index->set(e, _delta3->PRE_HEAP);
     2837        (*_delta3_index)[e] = _delta3->PRE_HEAP;
    28382838      }
    28392839      for (int i = 0; i < _blossom_num; ++i) {
    2840         _delta2_index->set(i, _delta2->PRE_HEAP);
    2841         _delta4_index->set(i, _delta4->PRE_HEAP);
     2840        (*_delta2_index)[i] = _delta2->PRE_HEAP;
     2841        (*_delta4_index)[i] = _delta4->PRE_HEAP;
    28422842      }
    28432843
     
    28512851          }
    28522852        }
    2853         _node_index->set(n, index);
     2853        (*_node_index)[n] = index;
    28542854        (*_node_data)[index].pot = max;
    28552855        int blossom =
  • lemon/min_cost_arborescence.h

    r559 r584  
    9191  /// \ingroup spantree
    9292  ///
    93   /// \brief %MinCostArborescence algorithm class.
     93  /// \brief Minimum Cost Arborescence algorithm class.
    9494  ///
    9595  /// This class provides an efficient implementation of
    96   /// %MinCostArborescence algorithm. The arborescence is a tree
     96  /// Minimum Cost Arborescence algorithm. The arborescence is a tree
    9797  /// which is directed from a given source node of the digraph. One or
    9898  /// more sources should be given for the algorithm and it will calculate
     
    294294        }
    295295      }
    296       _arc_order->set(minimum.arc, _dual_variables.size());
     296      (*_arc_order)[minimum.arc] = _dual_variables.size();
    297297      DualVariable var(_dual_node_list.size() - 1,
    298298                       _dual_node_list.size(), minimum.value);
     
    336336        }
    337337      }
    338       _arc_order->set(minimum.arc, _dual_variables.size());
     338      (*_arc_order)[minimum.arc] = _dual_variables.size();
    339339      DualVariable var(node_bottom, _dual_node_list.size(), minimum.value);
    340340      _dual_variables.push_back(var);
     
    365365        Node source = _heap->top();
    366366        _heap->pop();
    367         _node_order->set(source, -1);
     367        (*_node_order)[source] = -1;
    368368        for (OutArcIt it(*_digraph, source); it != INVALID; ++it) {
    369369          if ((*_arc_order)[it] < 0) continue;
     
    391391  public:
    392392
    393     /// \name Named template parameters
     393    /// \name Named Template Parameters
    394394
    395395    /// @{
     
    631631    /// @}
    632632
    633     /// \name Execution control
     633    /// \name Execution Control
    634634    /// The simplest way to execute the algorithm is to use
    635635    /// one of the member functions called \c run(...). \n
     
    651651      for (NodeIt it(*_digraph); it != INVALID; ++it) {
    652652        (*_cost_arcs)[it].arc = INVALID;
    653         _node_order->set(it, -3);
    654         _heap_cross_ref->set(it, Heap::PRE_HEAP);
     653        (*_node_order)[it] = -3;
     654        (*_heap_cross_ref)[it] = Heap::PRE_HEAP;
    655655        _pred->set(it, INVALID);
    656656      }
    657657      for (ArcIt it(*_digraph); it != INVALID; ++it) {
    658658        _arborescence->set(it, false);
    659         _arc_order->set(it, -1);
     659        (*_arc_order)[it] = -1;
    660660      }
    661661      _dual_node_list.clear();
  • lemon/preflow.h

    r559 r581  
    405405      _phase = true;
    406406      for (NodeIt n(_graph); n != INVALID; ++n) {
    407         _excess->set(n, 0);
     407        (*_excess)[n] = 0;
    408408      }
    409409
     
    418418
    419419      std::vector<Node> queue;
    420       reached.set(_source, true);
     420      reached[_source] = true;
    421421
    422422      queue.push_back(_target);
    423       reached.set(_target, true);
     423      reached[_target] = true;
    424424      while (!queue.empty()) {
    425425        _level->initNewLevel();
     
    430430            Node u = _graph.source(e);
    431431            if (!reached[u] && _tolerance.positive((*_capacity)[e])) {
    432               reached.set(u, true);
     432              reached[u] = true;
    433433              _level->initAddItem(u);
    434434              nqueue.push_back(u);
     
    445445          if ((*_level)[u] == _level->maxLevel()) continue;
    446446          _flow->set(e, (*_capacity)[e]);
    447           _excess->set(u, (*_excess)[u] + (*_capacity)[e]);
     447          (*_excess)[u] += (*_capacity)[e];
    448448          if (u != _target && !_level->active(u)) {
    449449            _level->activate(u);
     
    479479        }
    480480        if (excess < 0 && n != _source) return false;
    481         _excess->set(n, excess);
     481        (*_excess)[n] = excess;
    482482      }
    483483
     
    488488
    489489      std::vector<Node> queue;
    490       reached.set(_source, true);
     490      reached[_source] = true;
    491491
    492492      queue.push_back(_target);
    493       reached.set(_target, true);
     493      reached[_target] = true;
    494494      while (!queue.empty()) {
    495495        _level->initNewLevel();
     
    501501            if (!reached[u] &&
    502502                _tolerance.positive((*_capacity)[e] - (*_flow)[e])) {
    503               reached.set(u, true);
     503              reached[u] = true;
    504504              _level->initAddItem(u);
    505505              nqueue.push_back(u);
     
    509509            Node v = _graph.target(e);
    510510            if (!reached[v] && _tolerance.positive((*_flow)[e])) {
    511               reached.set(v, true);
     511              reached[v] = true;
    512512              _level->initAddItem(v);
    513513              nqueue.push_back(v);
     
    525525          if ((*_level)[u] == _level->maxLevel()) continue;
    526526          _flow->set(e, (*_capacity)[e]);
    527           _excess->set(u, (*_excess)[u] + rem);
     527          (*_excess)[u] += rem;
    528528          if (u != _target && !_level->active(u)) {
    529529            _level->activate(u);
     
    537537          if ((*_level)[v] == _level->maxLevel()) continue;
    538538          _flow->set(e, 0);
    539           _excess->set(v, (*_excess)[v] + rem);
     539          (*_excess)[v] += rem;
    540540          if (v != _target && !_level->active(v)) {
    541541            _level->activate(v);
     
    578578              if (!_tolerance.less(rem, excess)) {
    579579                _flow->set(e, (*_flow)[e] + excess);
    580                 _excess->set(v, (*_excess)[v] + excess);
     580                (*_excess)[v] += excess;
    581581                excess = 0;
    582582                goto no_more_push_1;
    583583              } else {
    584584                excess -= rem;
    585                 _excess->set(v, (*_excess)[v] + rem);
     585                (*_excess)[v] += rem;
    586586                _flow->set(e, (*_capacity)[e]);
    587587              }
     
    601601              if (!_tolerance.less(rem, excess)) {
    602602                _flow->set(e, (*_flow)[e] - excess);
    603                 _excess->set(v, (*_excess)[v] + excess);
     603                (*_excess)[v] += excess;
    604604                excess = 0;
    605605                goto no_more_push_1;
    606606              } else {
    607607                excess -= rem;
    608                 _excess->set(v, (*_excess)[v] + rem);
     608                (*_excess)[v] += rem;
    609609                _flow->set(e, 0);
    610610              }
     
    616616        no_more_push_1:
    617617
    618           _excess->set(n, excess);
     618          (*_excess)[n] = excess;
    619619
    620620          if (excess != 0) {
     
    651651              if (!_tolerance.less(rem, excess)) {
    652652                _flow->set(e, (*_flow)[e] + excess);
    653                 _excess->set(v, (*_excess)[v] + excess);
     653                (*_excess)[v] += excess;
    654654                excess = 0;
    655655                goto no_more_push_2;
    656656              } else {
    657657                excess -= rem;
    658                 _excess->set(v, (*_excess)[v] + rem);
     658                (*_excess)[v] += rem;
    659659                _flow->set(e, (*_capacity)[e]);
    660660              }
     
    674674              if (!_tolerance.less(rem, excess)) {
    675675                _flow->set(e, (*_flow)[e] - excess);
    676                 _excess->set(v, (*_excess)[v] + excess);
     676                (*_excess)[v] += excess;
    677677                excess = 0;
    678678                goto no_more_push_2;
    679679              } else {
    680680                excess -= rem;
    681                 _excess->set(v, (*_excess)[v] + rem);
     681                (*_excess)[v] += rem;
    682682                _flow->set(e, 0);
    683683              }
     
    689689        no_more_push_2:
    690690
    691           _excess->set(n, excess);
     691          (*_excess)[n] = excess;
    692692
    693693          if (excess != 0) {
     
    732732      typename Digraph::template NodeMap<bool> reached(_graph);
    733733      for (NodeIt n(_graph); n != INVALID; ++n) {
    734         reached.set(n, (*_level)[n] < _level->maxLevel());
     734        reached[n] = (*_level)[n] < _level->maxLevel();
    735735      }
    736736
     
    740740      std::vector<Node> queue;
    741741      queue.push_back(_source);
    742       reached.set(_source, true);
     742      reached[_source] = true;
    743743
    744744      while (!queue.empty()) {
     
    750750            Node v = _graph.target(e);
    751751            if (!reached[v] && _tolerance.positive((*_flow)[e])) {
    752               reached.set(v, true);
     752              reached[v] = true;
    753753              _level->initAddItem(v);
    754754              nqueue.push_back(v);
     
    759759            if (!reached[u] &&
    760760                _tolerance.positive((*_capacity)[e] - (*_flow)[e])) {
    761               reached.set(u, true);
     761              reached[u] = true;
    762762              _level->initAddItem(u);
    763763              nqueue.push_back(u);
     
    793793            if (!_tolerance.less(rem, excess)) {
    794794              _flow->set(e, (*_flow)[e] + excess);
    795               _excess->set(v, (*_excess)[v] + excess);
     795              (*_excess)[v] += excess;
    796796              excess = 0;
    797797              goto no_more_push;
    798798            } else {
    799799              excess -= rem;
    800               _excess->set(v, (*_excess)[v] + rem);
     800              (*_excess)[v] += rem;
    801801              _flow->set(e, (*_capacity)[e]);
    802802            }
     
    816816            if (!_tolerance.less(rem, excess)) {
    817817              _flow->set(e, (*_flow)[e] - excess);
    818               _excess->set(v, (*_excess)[v] + excess);
     818              (*_excess)[v] += excess;
    819819              excess = 0;
    820820              goto no_more_push;
    821821            } else {
    822822              excess -= rem;
    823               _excess->set(v, (*_excess)[v] + rem);
     823              (*_excess)[v] += rem;
    824824              _flow->set(e, 0);
    825825            }
     
    831831      no_more_push:
    832832
    833         _excess->set(n, excess);
     833        (*_excess)[n] = excess;
    834834
    835835        if (excess != 0) {
  • lemon/random.h

    r559 r584  
    660660    /// @}
    661661
    662     ///\name Uniform distributions
     662    ///\name Uniform Distributions
    663663    ///
    664664    /// @{
     
    763763    /// @}
    764764
    765     ///\name Non-uniform distributions
     765    ///\name Non-uniform Distributions
    766766    ///
    767767    ///@{
     
    939939    ///@}
    940940
    941     ///\name Two dimensional distributions
     941    ///\name Two Dimensional Distributions
    942942    ///
    943943    ///@{
  • lemon/smart_graph.h

    r559 r582  
    192192  ///that <b> it does support only limited (only stack-like)
    193193  ///node and arc deletions</b>.
    194   ///It conforms to the \ref concepts::Digraph "Digraph concept" with
    195   ///an important extra feature that its maps are real \ref
    196   ///concepts::ReferenceMap "reference map"s.
     194  ///It fully conforms to the \ref concepts::Digraph "Digraph concept".
    197195  ///
    198196  ///\sa concepts::Digraph.
     
    630628  /// that <b> it does support only limited (only stack-like)
    631629  /// node and arc deletions</b>.
    632   /// Except from this it conforms to
    633   /// the \ref concepts::Graph "Graph concept".
    634   ///
    635   /// It also has an
    636   /// important extra feature that
    637   /// its maps are real \ref concepts::ReferenceMap "reference map"s.
     630  /// It fully conforms to the \ref concepts::Graph "Graph concept".
    638631  ///
    639632  /// \sa concepts::Graph.
    640   ///
    641633  class SmartGraph : public ExtendedSmartGraphBase {
    642634  private:
  • lemon/soplex.cc

    r540 r576  
    2121
    2222#include <soplex.h>
     23#include <spxout.h>
    2324
    2425
     
    2930  SoplexLp::SoplexLp() {
    3031    soplex = new soplex::SoPlex;
     32    messageLevel(MESSAGE_NOTHING);
    3133  }
    3234
     
    4850    _row_names_ref = lp._row_names_ref;
    4951
     52    messageLevel(MESSAGE_NOTHING);
    5053  }
    5154
     
    272275
    273276    _clear_temporals();
     277   
     278    _applyMessageLevel();
    274279
    275280    soplex::SPxSolver::Status status = soplex->solve();
     
    420425  }
    421426
     427  void SoplexLp::_messageLevel(MessageLevel level) {
     428    switch (level) {
     429    case MESSAGE_NOTHING:
     430      _message_level = -1;
     431      break;
     432    case MESSAGE_ERROR:
     433      _message_level = soplex::SPxOut::ERROR;
     434      break;
     435    case MESSAGE_WARNING:
     436      _message_level = soplex::SPxOut::WARNING;
     437      break;
     438    case MESSAGE_NORMAL:
     439      _message_level = soplex::SPxOut::INFO2;
     440      break;
     441    case MESSAGE_VERBOSE:
     442      _message_level = soplex::SPxOut::DEBUG;
     443      break;
     444    }
     445  }
     446
     447  void SoplexLp::_applyMessageLevel() {
     448    soplex::Param::setVerbose(_message_level);
     449  }
     450
    422451} //namespace lemon
    423452
  • lemon/soplex.h

    r540 r576  
    145145    virtual void _clear();
    146146
     147    void _messageLevel(MessageLevel m);
     148    void _applyMessageLevel();
     149
     150    int _message_level;
     151
    147152  };
    148153
  • lemon/suurballe.h

    r559 r584  
    289289    }
    290290
    291     /// \name Execution control
     291    /// \name Execution Control
    292292    /// The simplest way to execute the algorithm is to call the run()
    293293    /// function.
  • lemon/time_measure.h

    r548 r584  
    288288    Timer(bool run=true) :_running(run) {_reset();}
    289289
    290     ///\name Control the state of the timer
     290    ///\name Control the State of the Timer
    291291    ///Basically a Timer can be either running or stopped,
    292292    ///but it provides a bit finer control on the execution.
     
    396396    ///@}
    397397
    398     ///\name Query Functions for the ellapsed time
     398    ///\name Query Functions for the Ellapsed Time
    399399
    400400    ///@{
  • test/bfs_test.cc

    r440 r585  
    5959
    6060  Digraph G;
    61   Node s, t;
     61  Node s, t, n;
    6262  Arc e;
    63   int l;
     63  int l, i;
    6464  bool b;
    6565  BType::DistMap d(G);
    6666  BType::PredMap p(G);
    6767  Path<Digraph> pp;
     68  concepts::ReadMap<Node,bool> nm;
    6869
    6970  {
    7071    BType bfs_test(G);
     72    const BType& const_bfs_test = bfs_test;
    7173
    7274    bfs_test.run(s);
     
    7476    bfs_test.run();
    7577
    76     l  = bfs_test.dist(t);
    77     e  = bfs_test.predArc(t);
    78     s  = bfs_test.predNode(t);
    79     b  = bfs_test.reached(t);
    80     d  = bfs_test.distMap();
    81     p  = bfs_test.predMap();
    82     pp = bfs_test.path(t);
     78    bfs_test.init();
     79    bfs_test.addSource(s);
     80    n = bfs_test.processNextNode();
     81    n = bfs_test.processNextNode(t, b);
     82    n = bfs_test.processNextNode(nm, n);
     83    n = const_bfs_test.nextNode();
     84    b = const_bfs_test.emptyQueue();
     85    i = const_bfs_test.queueSize();
     86   
     87    bfs_test.start();
     88    bfs_test.start(t);
     89    bfs_test.start(nm);
     90
     91    l  = const_bfs_test.dist(t);
     92    e  = const_bfs_test.predArc(t);
     93    s  = const_bfs_test.predNode(t);
     94    b  = const_bfs_test.reached(t);
     95    d  = const_bfs_test.distMap();
     96    p  = const_bfs_test.predMap();
     97    pp = const_bfs_test.path(t);
    8398  }
    8499  {
     
    87102      ::SetDistMap<concepts::ReadWriteMap<Node,int> >
    88103      ::SetReachedMap<concepts::ReadWriteMap<Node,bool> >
     104      ::SetStandardProcessedMap
    89105      ::SetProcessedMap<concepts::WriteMap<Node,bool> >
    90       ::SetStandardProcessedMap
    91106      ::Create bfs_test(G);
     107     
     108    concepts::ReadWriteMap<Node,Arc> pred_map;
     109    concepts::ReadWriteMap<Node,int> dist_map;
     110    concepts::ReadWriteMap<Node,bool> reached_map;
     111    concepts::WriteMap<Node,bool> processed_map;
     112   
     113    bfs_test
     114      .predMap(pred_map)
     115      .distMap(dist_map)
     116      .reachedMap(reached_map)
     117      .processedMap(processed_map);
    92118
    93119    bfs_test.run(s);
    94120    bfs_test.run(s,t);
    95121    bfs_test.run();
     122   
     123    bfs_test.init();
     124    bfs_test.addSource(s);
     125    n = bfs_test.processNextNode();
     126    n = bfs_test.processNextNode(t, b);
     127    n = bfs_test.processNextNode(nm, n);
     128    n = bfs_test.nextNode();
     129    b = bfs_test.emptyQueue();
     130    i = bfs_test.queueSize();
     131   
     132    bfs_test.start();
     133    bfs_test.start(t);
     134    bfs_test.start(nm);
    96135
    97136    l  = bfs_test.dist(t);
  • test/circulation_test.cc

    r440 r585  
    7272  FlowMap flow;
    7373  BarrierMap bar;
     74  VType v;
     75  bool b;
    7476
    75   Circulation<Digraph, CapMap, CapMap, DeltaMap>
    76     ::SetFlowMap<FlowMap>
    77     ::SetElevator<Elev>
    78     ::SetStandardElevator<LinkedElev>
    79     ::Create circ_test(g,lcap,ucap,delta);
    80 
    81   circ_test.lowerCapMap(lcap);
    82   circ_test.upperCapMap(ucap);
    83   circ_test.deltaMap(delta);
    84   flow = circ_test.flowMap();
    85   circ_test.flowMap(flow);
     77  typedef Circulation<Digraph, CapMap, CapMap, DeltaMap>
     78            ::SetFlowMap<FlowMap>
     79            ::SetElevator<Elev>
     80            ::SetStandardElevator<LinkedElev>
     81            ::Create CirculationType;
     82  CirculationType circ_test(g, lcap, ucap, delta);
     83  const CirculationType& const_circ_test = circ_test;
     84   
     85  circ_test
     86    .lowerCapMap(lcap)
     87    .upperCapMap(ucap)
     88    .deltaMap(delta)
     89    .flowMap(flow);
    8690
    8791  circ_test.init();
     
    9094  circ_test.run();
    9195
    92   circ_test.barrier(n);
    93   circ_test.barrierMap(bar);
    94   circ_test.flow(a);
     96  v = const_circ_test.flow(a);
     97  const FlowMap& fm = const_circ_test.flowMap();
     98  b = const_circ_test.barrier(n);
     99  const_circ_test.barrierMap(bar);
     100 
     101  ignore_unused_variable_warning(fm);
    95102}
    96103
  • test/dfs_test.cc

    r440 r585  
    6363  Node s, t;
    6464  Arc e;
    65   int l;
     65  int l, i;
    6666  bool b;
    6767  DType::DistMap d(G);
    6868  DType::PredMap p(G);
    6969  Path<Digraph> pp;
     70  concepts::ReadMap<Arc,bool> am;
    7071
    7172  {
    7273    DType dfs_test(G);
     74    const DType& const_dfs_test = dfs_test;
    7375
    7476    dfs_test.run(s);
     
    7678    dfs_test.run();
    7779
    78     l  = dfs_test.dist(t);
    79     e  = dfs_test.predArc(t);
    80     s  = dfs_test.predNode(t);
    81     b  = dfs_test.reached(t);
    82     d  = dfs_test.distMap();
    83     p  = dfs_test.predMap();
    84     pp = dfs_test.path(t);
     80    dfs_test.init();
     81    dfs_test.addSource(s);
     82    e = dfs_test.processNextArc();
     83    e = const_dfs_test.nextArc();
     84    b = const_dfs_test.emptyQueue();
     85    i = const_dfs_test.queueSize();
     86   
     87    dfs_test.start();
     88    dfs_test.start(t);
     89    dfs_test.start(am);
     90
     91    l  = const_dfs_test.dist(t);
     92    e  = const_dfs_test.predArc(t);
     93    s  = const_dfs_test.predNode(t);
     94    b  = const_dfs_test.reached(t);
     95    d  = const_dfs_test.distMap();
     96    p  = const_dfs_test.predMap();
     97    pp = const_dfs_test.path(t);
    8598  }
    8699  {
     
    89102      ::SetDistMap<concepts::ReadWriteMap<Node,int> >
    90103      ::SetReachedMap<concepts::ReadWriteMap<Node,bool> >
     104      ::SetStandardProcessedMap
    91105      ::SetProcessedMap<concepts::WriteMap<Node,bool> >
    92       ::SetStandardProcessedMap
    93106      ::Create dfs_test(G);
     107
     108    concepts::ReadWriteMap<Node,Arc> pred_map;
     109    concepts::ReadWriteMap<Node,int> dist_map;
     110    concepts::ReadWriteMap<Node,bool> reached_map;
     111    concepts::WriteMap<Node,bool> processed_map;
     112   
     113    dfs_test
     114      .predMap(pred_map)
     115      .distMap(dist_map)
     116      .reachedMap(reached_map)
     117      .processedMap(processed_map);
    94118
    95119    dfs_test.run(s);
    96120    dfs_test.run(s,t);
    97121    dfs_test.run();
     122    dfs_test.init();
     123
     124    dfs_test.addSource(s);
     125    e = dfs_test.processNextArc();
     126    e = dfs_test.nextArc();
     127    b = dfs_test.emptyQueue();
     128    i = dfs_test.queueSize();
     129   
     130    dfs_test.start();
     131    dfs_test.start(t);
     132    dfs_test.start(am);
    98133
    99134    l  = dfs_test.dist(t);
  • test/dijkstra_test.cc

    r440 r585  
    6161
    6262  Digraph G;
    63   Node s, t;
     63  Node s, t, n;
    6464  Arc e;
    6565  VType l;
     66  int i;
    6667  bool b;
    6768  DType::DistMap d(G);
     
    6970  LengthMap length;
    7071  Path<Digraph> pp;
     72  concepts::ReadMap<Node,bool> nm;
    7173
    7274  {
    7375    DType dijkstra_test(G,length);
     76    const DType& const_dijkstra_test = dijkstra_test;
    7477
    7578    dijkstra_test.run(s);
    7679    dijkstra_test.run(s,t);
     80
     81    dijkstra_test.init();
     82    dijkstra_test.addSource(s);
     83    dijkstra_test.addSource(s, 1);
     84    n = dijkstra_test.processNextNode();
     85    n = const_dijkstra_test.nextNode();
     86    b = const_dijkstra_test.emptyQueue();
     87    i = const_dijkstra_test.queueSize();
     88   
     89    dijkstra_test.start();
     90    dijkstra_test.start(t);
     91    dijkstra_test.start(nm);
     92
     93    l  = const_dijkstra_test.dist(t);
     94    e  = const_dijkstra_test.predArc(t);
     95    s  = const_dijkstra_test.predNode(t);
     96    b  = const_dijkstra_test.reached(t);
     97    b  = const_dijkstra_test.processed(t);
     98    d  = const_dijkstra_test.distMap();
     99    p  = const_dijkstra_test.predMap();
     100    pp = const_dijkstra_test.path(t);
     101    l  = const_dijkstra_test.currentDist(t);
     102  }
     103  {
     104    DType
     105      ::SetPredMap<concepts::ReadWriteMap<Node,Arc> >
     106      ::SetDistMap<concepts::ReadWriteMap<Node,VType> >
     107      ::SetStandardProcessedMap
     108      ::SetProcessedMap<concepts::WriteMap<Node,bool> >
     109      ::SetOperationTraits<DijkstraDefaultOperationTraits<VType> >
     110      ::SetHeap<BinHeap<VType, concepts::ReadWriteMap<Node,int> > >
     111      ::SetStandardHeap<BinHeap<VType, concepts::ReadWriteMap<Node,int> > >
     112      ::SetHeap<BinHeap<VType, concepts::ReadWriteMap<Node,int> >,
     113                concepts::ReadWriteMap<Node,int> >
     114      ::Create dijkstra_test(G,length);
     115
     116    LengthMap length_map;
     117    concepts::ReadWriteMap<Node,Arc> pred_map;
     118    concepts::ReadWriteMap<Node,VType> dist_map;
     119    concepts::WriteMap<Node,bool> processed_map;
     120    concepts::ReadWriteMap<Node,int> heap_cross_ref;
     121    BinHeap<VType, concepts::ReadWriteMap<Node,int> > heap(heap_cross_ref);
     122   
     123    dijkstra_test
     124      .lengthMap(length_map)
     125      .predMap(pred_map)
     126      .distMap(dist_map)
     127      .processedMap(processed_map)
     128      .heap(heap, heap_cross_ref);
     129
     130    dijkstra_test.run(s);
     131    dijkstra_test.run(s,t);
     132
     133    dijkstra_test.addSource(s);
     134    dijkstra_test.addSource(s, 1);
     135    n = dijkstra_test.processNextNode();
     136    n = dijkstra_test.nextNode();
     137    b = dijkstra_test.emptyQueue();
     138    i = dijkstra_test.queueSize();
     139   
     140    dijkstra_test.start();
     141    dijkstra_test.start(t);
     142    dijkstra_test.start(nm);
    77143
    78144    l  = dijkstra_test.dist(t);
     
    80146    s  = dijkstra_test.predNode(t);
    81147    b  = dijkstra_test.reached(t);
    82     d  = dijkstra_test.distMap();
    83     p  = dijkstra_test.predMap();
     148    b  = dijkstra_test.processed(t);
    84149    pp = dijkstra_test.path(t);
    85   }
    86   {
    87     DType
    88       ::SetPredMap<concepts::ReadWriteMap<Node,Arc> >
    89       ::SetDistMap<concepts::ReadWriteMap<Node,VType> >
    90       ::SetProcessedMap<concepts::WriteMap<Node,bool> >
    91       ::SetStandardProcessedMap
    92       ::SetOperationTraits<DijkstraDefaultOperationTraits<VType> >
    93       ::SetHeap<BinHeap<VType, concepts::ReadWriteMap<Node,int> > >
    94       ::SetStandardHeap<BinHeap<VType, concepts::ReadWriteMap<Node,int> > >
    95       ::Create dijkstra_test(G,length);
    96 
    97     dijkstra_test.run(s);
    98     dijkstra_test.run(s,t);
    99 
    100     l  = dijkstra_test.dist(t);
    101     e  = dijkstra_test.predArc(t);
    102     s  = dijkstra_test.predNode(t);
    103     b  = dijkstra_test.reached(t);
    104     pp = dijkstra_test.path(t);
     150    l  = dijkstra_test.currentDist(t);
    105151  }
    106152
  • test/gomory_hu_test.cc

    r546 r596  
    33#include "test_tools.h"
    44#include <lemon/smart_graph.h>
     5#include <lemon/concepts/graph.h>
     6#include <lemon/concepts/maps.h>
    57#include <lemon/lgf_reader.h>
    68#include <lemon/gomory_hu.h>
     
    3335  "target 3\n";
    3436 
     37void checkGomoryHuCompile()
     38{
     39  typedef int Value;
     40  typedef concepts::Graph Graph;
     41
     42  typedef Graph::Node Node;
     43  typedef Graph::Edge Edge;
     44  typedef concepts::ReadMap<Edge, Value> CapMap;
     45  typedef concepts::ReadWriteMap<Node, bool> CutMap;
     46
     47  Graph g;
     48  Node n;
     49  CapMap cap;
     50  CutMap cut;
     51  Value v;
     52  int d;
     53
     54  GomoryHu<Graph, CapMap> gh_test(g, cap);
     55  const GomoryHu<Graph, CapMap>&
     56    const_gh_test = gh_test;
     57
     58  gh_test.run();
     59
     60  n = const_gh_test.predNode(n);
     61  v = const_gh_test.predValue(n);
     62  d = const_gh_test.rootDist(n);
     63  v = const_gh_test.minCutValue(n, n);
     64  v = const_gh_test.minCutMap(n, n, cut);
     65}
     66
    3567GRAPH_TYPEDEFS(Graph);
    3668typedef Graph::EdgeMap<int> IntEdgeMap;
     
    71103      ght.minCutMap(u, v, cm);
    72104      check(pf.flowValue() == ght.minCutValue(u, v), "Wrong cut 1");
    73       check(cm[u] != cm[v], "Wrong cut 3");
    74       check(pf.flowValue() == cutValue(graph, cm, capacity), "Wrong cut 2");
     105      check(cm[u] != cm[v], "Wrong cut 2");
     106      check(pf.flowValue() == cutValue(graph, cm, capacity), "Wrong cut 3");
    75107
    76108      int sum=0;
     
    85117        sum++;
    86118      check(sum == countNodes(graph), "Problem with MinCutNodeIt");
    87      
    88119    }
    89120  }
  • test/hao_orlin_test.cc

    r440 r597  
    2020
    2121#include <lemon/smart_graph.h>
     22#include <lemon/adaptors.h>
     23#include <lemon/concepts/digraph.h>
     24#include <lemon/concepts/maps.h>
     25#include <lemon/lgf_reader.h>
    2226#include <lemon/hao_orlin.h>
    2327
    24 #include <lemon/lgf_reader.h>
    2528#include "test_tools.h"
    2629
     
    3841  "5\n"
    3942  "@edges\n"
    40   "     label  capacity\n"
    41   "0 1  0      2\n"
    42   "1 2  1      2\n"
    43   "2 0  2      2\n"
    44   "3 4  3      2\n"
    45   "4 5  4      2\n"
    46   "5 3  5      2\n"
    47   "2 3  6      3\n";
     43  "     cap1 cap2 cap3\n"
     44  "0 1  1    1    1   \n"
     45  "0 2  2    2    4   \n"
     46  "1 2  4    4    4   \n"
     47  "3 4  1    1    1   \n"
     48  "3 5  2    2    4   \n"
     49  "4 5  4    4    4   \n"
     50  "5 4  4    4    4   \n"
     51  "2 3  1    6    6   \n"
     52  "4 0  1    6    6   \n";
     53
     54void checkHaoOrlinCompile()
     55{
     56  typedef int Value;
     57  typedef concepts::Digraph Digraph;
     58
     59  typedef Digraph::Node Node;
     60  typedef Digraph::Arc Arc;
     61  typedef concepts::ReadMap<Arc, Value> CapMap;
     62  typedef concepts::WriteMap<Node, bool> CutMap;
     63
     64  Digraph g;
     65  Node n;
     66  CapMap cap;
     67  CutMap cut;
     68  Value v;
     69
     70  HaoOrlin<Digraph, CapMap> ho_test(g, cap);
     71  const HaoOrlin<Digraph, CapMap>&
     72    const_ho_test = ho_test;
     73
     74  ho_test.init();
     75  ho_test.init(n);
     76  ho_test.calculateOut();
     77  ho_test.calculateIn();
     78  ho_test.run();
     79  ho_test.run(n);
     80
     81  v = const_ho_test.minCutValue();
     82  v = const_ho_test.minCutMap(cut);
     83}
     84
     85template <typename Graph, typename CapMap, typename CutMap>
     86typename CapMap::Value
     87  cutValue(const Graph& graph, const CapMap& cap, const CutMap& cut)
     88{
     89  typename CapMap::Value sum = 0;
     90  for (typename Graph::ArcIt a(graph); a != INVALID; ++a) {
     91    if (cut[graph.source(a)] && !cut[graph.target(a)])
     92      sum += cap[a];
     93  }
     94  return sum;
     95}
    4896
    4997int main() {
    50   SmartGraph graph;
    51   SmartGraph::EdgeMap<int> capacity(graph);
     98  SmartDigraph graph;
     99  SmartDigraph::ArcMap<int> cap1(graph), cap2(graph), cap3(graph);
     100  SmartDigraph::NodeMap<bool> cut(graph);
    52101
    53   istringstream lgfs(lgf);
    54   graphReader(graph, lgfs).
    55     edgeMap("capacity", capacity).run();
     102  istringstream input(lgf);
     103  digraphReader(graph, input)
     104    .arcMap("cap1", cap1)
     105    .arcMap("cap2", cap2)
     106    .arcMap("cap3", cap3)
     107    .run();
    56108
    57   HaoOrlin<SmartGraph, SmartGraph::EdgeMap<int> > ho(graph, capacity);
    58   ho.run();
     109  {
     110    HaoOrlin<SmartDigraph> ho(graph, cap1);
     111    ho.run();
     112    ho.minCutMap(cut);
     113   
     114    check(ho.minCutValue() == 1, "Wrong cut value");
     115    check(ho.minCutValue() == cutValue(graph, cap1, cut), "Wrong cut value");
     116  }
     117  {
     118    HaoOrlin<SmartDigraph> ho(graph, cap2);
     119    ho.run();
     120    ho.minCutMap(cut);
    59121
    60   check(ho.minCutValue() == 3, "Wrong cut value");
     122    check(ho.minCutValue() == 1, "Wrong cut value");
     123    check(ho.minCutValue() == cutValue(graph, cap2, cut), "Wrong cut value");
     124  }
     125  {
     126    HaoOrlin<SmartDigraph> ho(graph, cap3);
     127    ho.run();
     128    ho.minCutMap(cut);
     129   
     130    check(ho.minCutValue() == 1, "Wrong cut value");
     131    check(ho.minCutValue() == cutValue(graph, cap3, cut), "Wrong cut value");
     132  }
     133 
     134  typedef Undirector<SmartDigraph> UGraph;
     135  UGraph ugraph(graph);
     136 
     137  {
     138    HaoOrlin<UGraph, SmartDigraph::ArcMap<int> > ho(ugraph, cap1);
     139    ho.run();
     140    ho.minCutMap(cut);
     141   
     142    check(ho.minCutValue() == 2, "Wrong cut value");
     143    check(ho.minCutValue() == cutValue(ugraph, cap1, cut), "Wrong cut value");
     144  }
     145  {
     146    HaoOrlin<UGraph, SmartDigraph::ArcMap<int> > ho(ugraph, cap2);
     147    ho.run();
     148    ho.minCutMap(cut);
     149   
     150    check(ho.minCutValue() == 5, "Wrong cut value");
     151    check(ho.minCutValue() == cutValue(ugraph, cap2, cut), "Wrong cut value");
     152  }
     153  {
     154    HaoOrlin<UGraph, SmartDigraph::ArcMap<int> > ho(ugraph, cap3);
     155    ho.run();
     156    ho.minCutMap(cut);
     157   
     158    check(ho.minCutValue() == 5, "Wrong cut value");
     159    check(ho.minCutValue() == cutValue(ugraph, cap3, cut), "Wrong cut value");
     160  }
    61161
    62162  return 0;
  • test/kruskal_test.cc

    r440 r581  
    100100        "Total cost should be 10");
    101101
    102   edge_cost_map.set(e1, -10);
    103   edge_cost_map.set(e2, -9);
    104   edge_cost_map.set(e3, -8);
    105   edge_cost_map.set(e4, -7);
    106   edge_cost_map.set(e5, -6);
    107   edge_cost_map.set(e6, -5);
    108   edge_cost_map.set(e7, -4);
    109   edge_cost_map.set(e8, -3);
    110   edge_cost_map.set(e9, -2);
    111   edge_cost_map.set(e10, -1);
     102  edge_cost_map[e1] = -10;
     103  edge_cost_map[e2] = -9;
     104  edge_cost_map[e3] = -8;
     105  edge_cost_map[e4] = -7;
     106  edge_cost_map[e5] = -6;
     107  edge_cost_map[e6] = -5;
     108  edge_cost_map[e7] = -4;
     109  edge_cost_map[e8] = -3;
     110  edge_cost_map[e9] = -2;
     111  edge_cost_map[e10] = -1;
    112112
    113113  vector<Edge> tree_edge_vec(5);
  • test/lp_test.cc

    r551 r575  
    396396    cloneTest<CplexLp>();
    397397  } catch (CplexEnv::LicenseError& error) {
    398 #ifdef LEMON_FORCE_CPLEX_CHECK
    399398    check(false, error.what());
    400 #else
    401     std::cerr << error.what() << std::endl;
    402     std::cerr << "Cplex license check failed, lp check skipped" << std::endl;
    403 #endif
    404399  }
    405400#endif
  • test/mip_test.cc

    r567 r575  
    144144    cloneTest<CplexMip>();
    145145  } catch (CplexEnv::LicenseError& error) {
    146 #ifdef LEMON_FORCE_CPLEX_CHECK
    147146    check(false, error.what());
    148 #else
    149     std::cerr << error.what() << std::endl;
    150     std::cerr << "Cplex license check failed, lp check skipped" << std::endl;
    151 #endif
    152147  }
    153148#endif
  • test/preflow_test.cc

    r440 r585  
    8585  FlowMap flow;
    8686  CutMap cut;
    87 
    88   Preflow<Digraph, CapMap>
    89     ::SetFlowMap<FlowMap>
    90     ::SetElevator<Elev>
    91     ::SetStandardElevator<LinkedElev>
    92     ::Create preflow_test(g,cap,n,n);
    93 
    94   preflow_test.capacityMap(cap);
    95   flow = preflow_test.flowMap();
    96   preflow_test.flowMap(flow);
    97   preflow_test.source(n);
    98   preflow_test.target(n);
     87  VType v;
     88  bool b;
     89
     90  typedef Preflow<Digraph, CapMap>
     91            ::SetFlowMap<FlowMap>
     92            ::SetElevator<Elev>
     93            ::SetStandardElevator<LinkedElev>
     94            ::Create PreflowType;
     95  PreflowType preflow_test(g, cap, n, n);
     96  const PreflowType& const_preflow_test = preflow_test;
     97
     98  preflow_test
     99    .capacityMap(cap)
     100    .flowMap(flow)
     101    .source(n)
     102    .target(n);
    99103
    100104  preflow_test.init();
     
    105109  preflow_test.runMinCut();
    106110
    107   preflow_test.flowValue();
    108   preflow_test.minCut(n);
    109   preflow_test.minCutMap(cut);
    110   preflow_test.flow(e);
    111 
     111  v = const_preflow_test.flowValue();
     112  v = const_preflow_test.flow(e);
     113  const FlowMap& fm = const_preflow_test.flowMap();
     114  b = const_preflow_test.minCut(n);
     115  const_preflow_test.minCutMap(cut);
     116 
     117  ignore_unused_variable_warning(fm);
    112118}
    113119
  • tools/dimacs-solver.cc

    r569 r584  
    2424///
    2525/// See
    26 /// \verbatim
    27 ///  dimacs-solver --help
    28 /// \endverbatim
     26/// \code
     27///   dimacs-solver --help
     28/// \endcode
    2929/// for more info on usage.
    30 ///
    3130
    3231#include <iostream>
  • tools/dimacs-to-lgf.cc

    r561 r584  
    2525///
    2626/// See
    27 /// \verbatim
    28 ///  dimacs-to-lgf --help
    29 /// \endverbatim
    30 /// for more info on usage.
    31 ///
     27/// \code
     28///   dimacs-to-lgf --help
     29/// \endcode
     30/// for more info on the usage.
    3231
    3332#include <iostream>
  • tools/lemon-0.x-to-1.x.sh

    r555 r574  
    9090        -e "s/\<StoreBoolMap\>/LoggerBoolMap/g"\
    9191        -e "s/\<storeBoolMap\>/loggerBoolMap/g"\
     92        -e "s/\<InvertableMap\>/CrossRefMap/g"\
     93        -e "s/\<invertableMap\>/crossRefMap/g"\
     94        -e "s/\<DescriptorMap\>/RangeIdMap/g"\
     95        -e "s/\<descriptorMap\>/rangeIdMap/g"\
    9296        -e "s/\<BoundingBox\>/Box/g"\
    9397        -e "s/\<readNauty\>/readNautyGraph/g"\
  • tools/lgf-gen.cc

    r570 r584  
    2424///
    2525/// See
    26 /// \verbatim
    27 ///  lgf-gen --help
    28 /// \endverbatim
     26/// \code
     27///   lgf-gen --help
     28/// \endcode
    2929/// for more info on the usage.
    30 ///
    31 
    3230
    3331#include <algorithm>
Note: See TracChangeset for help on using the changeset viewer.