[Lemon-commits] [lemon_svn] jacint: r2294 - hugo/trunk/lemon
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:51:35 CET 2006
Author: jacint
Date: Fri Nov 4 14:53:22 2005
New Revision: 2294
Modified:
hugo/trunk/lemon/preflow.h
Log:
throwing an exception if s=t
Modified: hugo/trunk/lemon/preflow.h
==============================================================================
--- hugo/trunk/lemon/preflow.h (original)
+++ hugo/trunk/lemon/preflow.h Fri Nov 4 14:53:22 2005
@@ -20,6 +20,7 @@
#include <vector>
#include <queue>
+#include <lemon/error.h>
#include <lemon/invalid.h>
#include <lemon/maps.h>
#include <lemon/graph_utils.h>
@@ -88,10 +89,21 @@
static const int H0=20;
static const int H1=1;
- public:
+ public:
- ///Indicates the property of the starting flow map.
+ ///\ref Exception for the case when s=t.
+ ///\ref Exception for the case when the source equals the target.
+ class InvalidArgument : public lemon::LogicError {
+ public:
+ virtual const char* exceptionName() const {
+ return "lemon::Preflow::InvalidArgument";
+ }
+ };
+
+
+ ///Indicates the property of the starting flow map.
+
///Indicates the property of the starting flow map.
///The meanings are as follows:
///- \c ZERO_FLOW: constant zero flow
@@ -126,8 +138,8 @@
AFTER_PREFLOW_PHASE_2
};
- protected:
- FlowEnum flow_prop;
+ protected:
+ FlowEnum flow_prop;
StatusEnum status; // Do not needle this flag only if necessary.
public:
@@ -146,8 +158,11 @@
const CapacityMap& _cap, FlowMap& _f) :
_g(&_gr), _source(_s), _target(_t), _capacity(&_cap),
_flow(&_f), _node_num(countNodes(_gr)), level(_gr), excess(_gr,0),
- flow_prop(NO_FLOW), status(AFTER_NOTHING) { }
-
+ flow_prop(NO_FLOW), status(AFTER_NOTHING) {
+ if ( _source==_target )
+ throw InvalidArgument();
+ }
+
///Runs the preflow algorithm.
More information about the Lemon-commits
mailing list