Index: src/hugo/graph_wrapper.h
===================================================================
--- src/hugo/graph_wrapper.h	(revision 849)
+++ src/hugo/graph_wrapper.h	(revision 854)
@@ -379,5 +379,10 @@
       NodeIt(Invalid i) : Node(i) { }
       NodeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw) : 
-	Node(typename Graph::NodeIt(*(_gw.graph))), gw(&_gw) { }
+	Node(typename Graph::NodeIt(*(_gw.graph))), gw(&_gw) { 
+	while (*static_cast<Node*>(this)!=INVALID && 
+	       !(*(gw->edge_filter_map))[*this]) 
+	  *(static_cast<Node*>(this))=
+	    ++(typename Graph::NodeIt(*(gw->graph), *this));
+      }
       NodeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, 
 	     const Node& n) : 
@@ -402,5 +407,10 @@
       OutEdgeIt(Invalid i) : Edge(i) { }
       OutEdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, const Node& n) : 
-	Edge(typename Graph::OutEdgeIt(*(_gw.graph), n)), gw(&_gw) { }
+	Edge(typename Graph::OutEdgeIt(*(_gw.graph), n)), gw(&_gw) { 
+	while (*static_cast<Edge*>(this)!=INVALID && 
+	       !(*(gw->edge_filter_map))[*this]) 
+	  *(static_cast<Edge*>(this))=
+	    ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
+      }
       OutEdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, 
 	     const Edge& e) : 
@@ -424,5 +434,10 @@
       InEdgeIt(Invalid i) : Edge(i) { }
       InEdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, const Node& n) : 
-	Edge(typename Graph::InEdgeIt(*(_gw.graph), n)), gw(&_gw) { }
+	Edge(typename Graph::InEdgeIt(*(_gw.graph), n)), gw(&_gw) { 
+	while (*static_cast<Edge*>(this)!=INVALID && 
+	       !(*(gw->edge_filter_map))[*this]) 
+	  *(static_cast<Edge*>(this))=
+	    ++(typename Graph::InEdgeIt(*(gw->graph), *this));
+      }
       InEdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, 
 	     const Edge& e) : 
@@ -446,5 +461,10 @@
       EdgeIt(Invalid i) : Edge(i) { }
       EdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw) : 
-	Edge(typename Graph::EdgeIt(*(_gw.graph))), gw(&_gw) { }
+	Edge(typename Graph::EdgeIt(*(_gw.graph))), gw(&_gw) { 
+	while (*static_cast<Edge*>(this)!=INVALID && 
+	       !(*(gw->edge_filter_map))[*this]) 
+	  *(static_cast<Edge*>(this))=
+	    ++(typename Graph::EdgeIt(*(gw->graph), *this));
+      }
       EdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, 
 	     const Edge& e) : 
Index: src/work/makefile
===================================================================
--- src/work/makefile	(revision 773)
+++ src/work/makefile	(revision 854)
@@ -1,4 +1,4 @@
 INCLUDEDIRS ?= -I.. -I. -I./{marci,jacint,alpar,klao,akos}
-CXXFLAGS = -g -O3 -W -Wall $(INCLUDEDIRS) -ansi -pedantic
+CXXFLAGS = -g -O0 -W -Wall $(INCLUDEDIRS) -ansi -pedantic
 
 BINARIES ?= bin_heap_demo
Index: src/work/marci/augmenting_flow.h
===================================================================
--- src/work/marci/augmenting_flow.h	(revision 777)
+++ src/work/marci/augmenting_flow.h	(revision 854)
@@ -1262,7 +1262,7 @@
 	  typename MG::Edge f=F.addEdge(res_graph_to_F[res_graph.tail(e)],
 					res_graph_to_F[res_graph.head(e)]);
-	  original_edge.update();
+	  //original_edge.update();
 	  original_edge.set(f, e);
-	  residual_capacity.update();
+	  //residual_capacity.update();
 	  residual_capacity.set(f, res_graph.resCap(e));
 	} else {
@@ -1270,7 +1270,7 @@
 	    typename MG::Edge f=F.addEdge(res_graph_to_F[res_graph.tail(e)],
 					  res_graph_to_F[res_graph.head(e)]);
-	    original_edge.update();
+	    //original_edge.update();
 	    original_edge.set(f, e);
-	    residual_capacity.update();
+	    //residual_capacity.update();
 	    residual_capacity.set(f, res_graph.resCap(e));
 	  }
@@ -1295,5 +1295,5 @@
       while (!dfs.finished()) {
 	++dfs;
-	if (F.valid(/*typename MG::OutEdgeIt*/(dfs))) {
+	if (typename MG::Edge(dfs)!=INVALID) {
 	  if (dfs.isBNodeNewlyReached()) {
 	    typename MG::Node v=F.tail(dfs);
@@ -1312,5 +1312,5 @@
 
 	  } else {
-	    F.erase(/*typename MG::OutEdgeIt*/(dfs));
+	    F.erase(typename MG::Edge(dfs));
 	  }
 	}
Index: src/work/marci/max_flow_demo.cc
===================================================================
--- src/work/marci/max_flow_demo.cc	(revision 849)
+++ src/work/marci/max_flow_demo.cc	(revision 854)
@@ -4,17 +4,13 @@
 // max_flow_demo < dimacs_max_flow_file
 
-
 #include <iostream>
 #include <fstream>
 
-#include <sage_graph.h>
 #include <hugo/smart_graph.h>
+#include <hugo/list_graph.h>
 #include <hugo/dimacs.h>
 #include <hugo/time_measure.h>
-//#include <graph_wrapper.h>
 #include <hugo/preflow.h>
 #include <augmenting_flow.h>
-//#include <preflow_res.h>
-#include <for_each_macros.h>
 #include <graph_concept.h>
 
@@ -23,9 +19,6 @@
 int main(int, char **) {
 
-  typedef SageGraph MutableGraph;
-
-  //typedef FullFeatureGraphConcept Graph;
-  //typedef SmartGraph Graph;
-  typedef SageGraph Graph;
+  typedef ListGraph MutableGraph;
+  typedef SmartGraph Graph;
   typedef Graph::Node Node;
   typedef Graph::EdgeIt EdgeIt;
@@ -54,5 +47,5 @@
     max_flow_test.minCut(cut);
 
-    FOR_EACH_LOC(Graph::EdgeIt, e, g) {
+    for(Graph::EdgeIt e(g); e!=INVALID; ++e) {
       if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e]) 
 	std::cout << "Slackness does not hold!" << std::endl;
@@ -64,11 +57,11 @@
   {
     std::cout << "preflow ..." << std::endl;
-    FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0);
+    for(Graph::EdgeIt e(g); e!=INVALID; ++e) flow.set(e, 0);
     ts.reset();
-    max_flow_test.preflow(Preflow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> >::GEN_FLOW);
+    max_flow_test.run(Preflow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> >::GEN_FLOW);
     std::cout << "elapsed time: " << ts << std::endl;
     std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
 
-    FOR_EACH_LOC(Graph::EdgeIt, e, g) {
+    for(Graph::EdgeIt e(g); e!=INVALID; ++e) {
       if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e]) 
 	std::cout << "Slackness does not hold!" << std::endl;
@@ -89,5 +82,5 @@
   {
     std::cout << "physical blocking flow augmentation ..." << std::endl;
-    FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0);
+    for(Graph::EdgeIt e(g); e!=INVALID; ++e) flow.set(e, 0);
     ts.reset();
     int i=0;
@@ -97,5 +90,5 @@
     std::cout << "flow value: "<< augmenting_flow_test.flowValue() << std::endl;
 
-    FOR_EACH_LOC(Graph::EdgeIt, e, g) {
+    for(Graph::EdgeIt e(g); e!=INVALID; ++e) {
       if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e]) 
 	std::cout << "Slackness does not hold!" << std::endl;
@@ -107,5 +100,5 @@
   {
     std::cout << "on-the-fly blocking flow augmentation ..." << std::endl;
-    FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0);
+    for(Graph::EdgeIt e(g); e!=INVALID; ++e) flow.set(e, 0);
     ts.reset();
     int i=0;
@@ -115,5 +108,5 @@
     std::cout << "flow value: "<< augmenting_flow_test.flowValue() << std::endl;
 
-    FOR_EACH_LOC(Graph::EdgeIt, e, g) {
+    for(Graph::EdgeIt e(g); e!=INVALID; ++e) {
       if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e]) 
 	std::cout << "Slackness does not hold!" << std::endl;
@@ -125,5 +118,5 @@
   {
     std::cout << "on-the-fly shortest path augmentation ..." << std::endl;
-    FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0);
+    for(Graph::EdgeIt e(g); e!=INVALID; ++e) flow.set(e, 0);
     ts.reset();
     int i=0;
@@ -133,5 +126,5 @@
     std::cout << "flow value: "<< augmenting_flow_test.flowValue() << std::endl;
 
-    FOR_EACH_LOC(Graph::EdgeIt, e, g) {
+    for(Graph::EdgeIt e(g); e!=INVALID; ++e) {
       if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e]) 
 	std::cout << "Slackness does not hold!" << std::endl;
@@ -143,5 +136,5 @@
   {
     std::cout << "on-the-fly shortest path augmentation ..." << std::endl;
-    FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0);
+    for(Graph::EdgeIt e(g); e!=INVALID; ++e) flow.set(e, 0);
     ts.reset();
     int i=0;
@@ -151,5 +144,5 @@
     std::cout << "flow value: "<< augmenting_flow_test.flowValue() << std::endl;
 
-    FOR_EACH_LOC(Graph::EdgeIt, e, g) {
+    for(Graph::EdgeIt e(g); e!=INVALID; ++e) {
       if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e]) 
 	std::cout << "Slackness does not hold!" << std::endl;
