Index: src/work/marci/lp/max_flow_by_lp.cc
===================================================================
--- src/work/marci/lp/max_flow_by_lp.cc	(revision 986)
+++ src/work/marci/lp/max_flow_by_lp.cc	(revision 1014)
@@ -3,13 +3,12 @@
 #include <fstream>
 
-#include <sage_graph.h>
 #include <lemon/smart_graph.h>
+#include <lemon/list_graph.h>
 #include <lemon/dimacs.h>
 #include <lemon/time_measure.h>
 //#include <graph_wrapper.h>
-#include <lemon/max_flow.h>
+#include <lemon/preflow.h>
 #include <augmenting_flow.h>
 //#include <preflow_res.h>
-#include <for_each_macros.h>
 #include <lp_solver_wrapper.h>
 
@@ -34,7 +33,6 @@
 int main(int, char **) {
 
-  typedef SageGraph MutableGraph;
-  //typedef SmartGraph Graph;
-  typedef SageGraph Graph;
+  typedef ListGraph MutableGraph;
+  typedef SmartGraph Graph;
   typedef Graph::Node Node;
   typedef Graph::EdgeIt EdgeIt;
@@ -48,5 +46,5 @@
   Timer ts;
   Graph::EdgeMap<int> flow(g); //0 flow
-  MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > 
+  Preflow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > 
     max_flow_test(g, s, t, cap, flow);
   AugmentingFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > 
@@ -61,7 +59,7 @@
     std::cout << "elapsed time: " << ts << std::endl;
     std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
-    max_flow_test.actMinCut(cut);
-
-    FOR_EACH_LOC(Graph::EdgeIt, e, g) {
+    max_flow_test.minCut(cut);
+
+    for (Graph::EdgeIt e(g); e!=INVALID; ++e) {
       if (cut[g.source(e)] && !cut[g.target(e)] && !flow[e]==cap[e]) 
 	std::cout << "Slackness does not hold!" << std::endl;
@@ -75,5 +73,5 @@
 //     FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0);
 //     ts.reset();
-//     max_flow_test.preflow(MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> >::GEN_FLOW);
+//     max_flow_test.preflow(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;
@@ -98,5 +96,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;
@@ -106,5 +104,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.source(e)] && !cut[g.target(e)] && !flow[e]==cap[e]) 
 	std::cout << "Slackness does not hold!" << std::endl;
@@ -127,5 +125,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;
@@ -135,5 +133,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.source(e)] && !cut[g.target(e)] && !flow[e]==cap[e]) 
 	std::cout << "Slackness does not hold!" << std::endl;
@@ -187,27 +185,19 @@
   EdgeIndexMap edge_index_map(g);
   PrimalMap<Graph::Edge, EdgeIndexMap> lp_flow(lp, edge_index_map);
-  Graph::EdgeIt e;
-  for (g.first(e); g.valid(e); g.next(e)) {
+  for (Graph::EdgeIt e(g); e!=INVALID; ++e) {
     ColIt col_it=lp.addCol();
     edge_index_map.set(e, col_it);
     lp.setColBounds(col_it, LPX_DB, 0.0, cap[e]);
   }
-  Graph::NodeIt n;
-  for (g.first(n); g.valid(n); g.next(n)) {
+  for (Graph::NodeIt n(g); n!=INVALID; ++n) {
     if (n!=s) {
       //hurokelek miatt
       Graph::EdgeMap<int> coeffs(g, 0);
-      {
-	Graph::InEdgeIt e;
-	for (g.first(e, n); g.valid(e); g.next(e)) coeffs.set(e, coeffs[e]+1);
-      }
-      {
-	Graph::OutEdgeIt e;
-	for (g.first(e, n); g.valid(e); g.next(e)) coeffs.set(e, coeffs[e]-1);
-      }
+      for (Graph::InEdgeIt e(g, n); e!=INVALID; ++e) 
+	coeffs.set(e, coeffs[e]+1);
+      for (Graph::OutEdgeIt e(g, n); e!=INVALID; ++e) 
+	coeffs.set(e, coeffs[e]-1);
       if (n==t) {
-	Graph::EdgeIt e;
-	//std::vector< std::pair<ColIt, double> > row;
-	for (g.first(e); g.valid(e); g.next(e)) {
+	for (Graph::EdgeIt e(g); e!=INVALID; ++e) {
 	  if (coeffs[e]!=0) 
 	    lp.setObjCoef(edge_index_map[e], coeffs[e]);
@@ -215,7 +205,6 @@
       } else  {
 	RowIt row_it=lp.addRow();
-	Graph::EdgeIt e;
 	std::vector< std::pair<ColIt, double> > row;
-	for (g.first(e); g.valid(e); g.next(e)) {
+	for (Graph::EdgeIt e(g); e!=INVALID; ++e) {
 	  if (coeffs[e]!=0) 
 	    row.push_back(std::make_pair(edge_index_map[e], coeffs[e]));
