Index: src/work/marci/augmenting_flow.h
===================================================================
--- src/work/marci/augmenting_flow.h	(revision 762)
+++ src/work/marci/augmenting_flow.h	(revision 775)
@@ -1021,5 +1021,5 @@
       case AFTER_AUGMENTING:
 //	std::cout << "AFTER_AUGMENTING" << std::endl;
-	for(g->first(v); g->valid(v); g->next(v)) {
+	for(g->first(v); v!=INVALID; ++v) {
 	  if (level[v]) {
 	    M.set(v, true);
@@ -1031,5 +1031,5 @@
       case AFTER_FAST_AUGMENTING:
 //	std::cout << "AFTER_FAST_AUGMENTING" << std::endl;
-	for(g->first(v); g->valid(v); g->next(v)) {
+	for(g->first(v); v!=INVALID; ++v) {
 	  if (level[v]==number_of_augmentations) {
 	    M.set(v, true);
@@ -1054,5 +1054,5 @@
 
 	OutEdgeIt e;
-	for(g->first(e,w) ; g->valid(e); g->next(e)) {
+	for(g->first(e,w) ; e!=INVALID; ++e) {
 	  Node v=g->head(e);
 	  if (!M[v] && (*flow)[e] < (*capacity)[e] ) {
@@ -1063,5 +1063,5 @@
 
 	InEdgeIt f;
-	for(g->first(f,w) ; g->valid(f); g->next(f)) {
+	for(g->first(f,w) ; f!=INVALID; ++f) {
 	  Node v=g->tail(f);
 	  if (!M[v] && (*flow)[f] > 0 ) {
@@ -1134,9 +1134,9 @@
     while ( !bfs.finished() ) {
       ResGWOutEdgeIt e=bfs;
-      if (res_graph.valid(e) && bfs.isBNodeNewlyReached()) {
+      if (e!=INVALID && bfs.isBNodeNewlyReached()) {
 	Node v=res_graph.tail(e);
 	Node w=res_graph.head(e);
 	pred.set(w, e);
-	if (res_graph.valid(pred[v])) {
+	if (pred[v]!=INVALID) {
 	  free.set(w, std::min(free[v], res_graph.resCap(e)));
 	} else {
@@ -1152,5 +1152,5 @@
       Node n=t;
       Num augment_value=free[t];
-      while (res_graph.valid(pred[n])) {
+      while (pred[n]!=INVALID) {
 	ResGWEdge e=pred[n];
 	res_graph.augment(e, augment_value);
@@ -1191,9 +1191,9 @@
     while ( !bfs.finished() ) {
       ResGWOutEdgeIt e=bfs;
-      if (res_graph.valid(e) && bfs.isBNodeNewlyReached()) {
+      if (e!=INVALID && bfs.isBNodeNewlyReached()) {
 	Node v=res_graph.tail(e);
 	Node w=res_graph.head(e);
 	pred.set(w, e);
-	if (res_graph.valid(pred[v])) {
+	if (pred[v]!=INVALID) {
 	  free.set(w, std::min(free[v], res_graph.resCap(e)));
 	} else {
@@ -1209,5 +1209,5 @@
       Node n=t;
       Num augment_value=free[t];
-      while (res_graph.valid(pred[n])) {
+      while (pred[n]!=INVALID) {
 	ResGWEdge e=pred[n];
 	res_graph.augment(e, augment_value);
@@ -1245,5 +1245,5 @@
     {
       typename ResGW::NodeIt n;
-      for(res_graph.first(n); res_graph.valid(n); res_graph.next(n)) {
+      for(res_graph.first(n); n!=INVALID; ++n) {
 	res_graph_to_F.set(n, F.addNode());
       }
@@ -1257,5 +1257,5 @@
     while ( !bfs.finished() ) {
       ResGWOutEdgeIt e=bfs;
-      if (res_graph.valid(e)) {
+      if (e!=INVALID) {
 	if (bfs.isBNodeNewlyReached()) {
 	  dist.set(res_graph.head(e), dist[res_graph.tail(e)]+1);
@@ -1300,5 +1300,5 @@
 	    typename MG::Node w=F.bNode(dfs);
 	    pred.set(w, dfs);
-	    if (F.valid(pred[v])) {
+	    if (pred[v]!=INVALID) {
 	      free.set(w, std::min(free[v], residual_capacity[dfs]));
 	    } else {
@@ -1320,5 +1320,5 @@
 	typename MG::Node n=tF;
 	Num augment_value=free[tF];
-	while (F.valid(pred[n])) {
+	while (pred[n]!=INVALID) {
 	  typename MG::Edge e=pred[n];
 	  res_graph.augment(original_edge[e], augment_value);
@@ -1338,6 +1338,4 @@
 
 
-
-
   template <typename Graph, typename Num, typename CapMap, typename FlowMap>
   bool AugmentingFlow<Graph, Num, CapMap, FlowMap>::augmentOnBlockingFlow2()
@@ -1355,5 +1353,5 @@
     while ( !bfs.finished() ) {
       ResGWOutEdgeIt e=bfs;
-      if (res_graph.valid(e) && bfs.isBNodeNewlyReached()) {
+      if (e!=INVALID && bfs.isBNodeNewlyReached()) {
 	dist.set(res_graph.head(e), dist[res_graph.tail(e)]+1);
       }
@@ -1372,6 +1370,5 @@
       first_out_edges(filter_res_graph);
     typename FilterResGW::NodeIt v;
-    for(filter_res_graph.first(v); filter_res_graph.valid(v);
-	filter_res_graph.next(v))
+    for(filter_res_graph.first(v); v!=INVALID; ++v)
       {
  	typename FilterResGW::OutEdgeIt e;
@@ -1419,5 +1416,5 @@
 
  	      pred.set(w, /*typename ErasingResGW::OutEdgeIt*/(dfs));
- 	      if (erasing_res_graph.valid(pred[v])) {
+ 	      if (pred[v]!=INVALID) {
  		free1.set
 		  (w, std::min(free1[v], res_graph.resCap
