COIN-OR::LEMON - Graph Library

Changeset 1762:3915867b6975 in lemon-0.x


Ignore:
Timestamp:
11/04/05 14:53:22 (14 years ago)
Author:
jacint
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2294
Message:

throwing an exception if s=t

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/preflow.h

    r1742 r1762  
    2121#include <queue>
    2222
     23#include <lemon/error.h>
    2324#include <lemon/invalid.h>
    2425#include <lemon/maps.h>
     
    8990    static const int H1=1;
    9091
     92  public:
     93
     94    ///\ref Exception for the case when s=t.
     95
     96    ///\ref Exception for the case when the source equals the target.
     97    class InvalidArgument : public lemon::LogicError {
    9198    public:
    92 
     99      virtual const char* exceptionName() const {
     100        return "lemon::Preflow::InvalidArgument";
     101      }
     102    };
     103   
     104   
    93105    ///Indicates the property of the starting flow map.
    94 
     106   
    95107    ///Indicates the property of the starting flow map.
    96108    ///The meanings are as follows:
     
    127139    };
    128140   
    129     protected:
    130       FlowEnum flow_prop;
     141  protected:
     142    FlowEnum flow_prop;
    131143    StatusEnum status; // Do not needle this flag only if necessary.
    132144   
     
    147159        _g(&_gr), _source(_s), _target(_t), _capacity(&_cap),
    148160        _flow(&_f), _node_num(countNodes(_gr)), level(_gr), excess(_gr,0),
    149         flow_prop(NO_FLOW), status(AFTER_NOTHING) { }
    150 
     161        flow_prop(NO_FLOW), status(AFTER_NOTHING) {
     162        if ( _source==_target )
     163          throw InvalidArgument();
     164      }
     165   
    151166
    152167                                                                             
Note: See TracChangeset for help on using the changeset viewer.