[Lemon-commits] [lemon_svn] jacint: r1195 - hugo/trunk/src/test

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:43:47 CET 2006


Author: jacint
Date: Mon Sep 20 10:27:34 2004
New Revision: 1195

Added:
   hugo/trunk/src/test/preflow_graph.dim
Removed:
   hugo/trunk/src/test/preflow_graph.inp
Modified:
   hugo/trunk/src/test/preflow_test.cc

Log:
new test graph

Added: hugo/trunk/src/test/preflow_graph.dim
==============================================================================
--- (empty file)
+++ hugo/trunk/src/test/preflow_graph.dim	Mon Sep 20 10:27:34 2004
@@ -0,0 +1,20 @@
+p max 10 17
+n 2 s
+n 9 t
+a 1 2 20
+a 1 3 0
+a 2 2 3
+a 2 3 8
+a 2 4 8
+a 3 6 5
+a 4 3 5
+a 4 6 5
+a 4 7 5
+a 5 4 3
+a 6 8 3
+a 6 7 10
+a 6 9 10
+a 7 9 8
+a 9 10 20
+a 9 2 5
+a 10 6 5
\ No newline at end of file

Modified: hugo/trunk/src/test/preflow_test.cc
==============================================================================
--- hugo/trunk/src/test/preflow_test.cc	(original)
+++ hugo/trunk/src/test/preflow_test.cc	Mon Sep 20 10:27:34 2004
@@ -71,10 +71,10 @@
 
   std::string f_name;
   if( getenv("srcdir") ) {
-    f_name = std::string(getenv("srcdir")) + "/preflow_graph.inp";
+    f_name = std::string(getenv("srcdir")) + "/preflow_graph.dim";
   }
   else {
-    f_name = "preflow_graph.inp";
+    f_name = "preflow_graph.dim";
   }
   
   std::ifstream file(f_name.c_str());
@@ -87,11 +87,12 @@
   readDimacs(file, G, cap, s, t);
 
   FlowMap flow(G,0);
+
  
+
   PType preflow_test(G, s, t, cap, flow);
   preflow_test.run(PType::ZERO_FLOW);
- 
-   
+    
   CutMap mincut(G,false);
   preflow_test.minCut(mincut); 
   int min_cut_value=cut_value(G,mincut,cap);
@@ -112,16 +113,10 @@
   int flow_value=preflow_test.flowValue();
 
 
+
   for(EdgeIt e(G); e!=INVALID; ++e) cap[e]=2*cap[e]; 
   preflow_test.setCap(cap);  
 
-  NodeIt tmp_node(G,t);
-  ++tmp_node;
-  t=tmp_node;
-  
-  preflow_test.setTarget(t); //the max flow value remains 2*flow_value
-  //warning: ++t must be a valid node. In preflow_graph, it is.
-
   preflow_test.phase1(PType::PRE_FLOW);
 
   CutMap mincut1(G,false);
@@ -141,10 +136,8 @@
   CutMap minmincut2(G,false);
   preflow_test.minMinCut(minmincut2); 
   min_min_cut_value=cut_value(G,minmincut2,cap);
-
  
   preflow_test.maxMinCut(maxmincut); 
-  
   max_min_cut_value=cut_value(G,maxmincut,cap);
 
   check(preflow_test.flowValue() == min_cut_value &&
@@ -153,15 +146,27 @@
 	min_cut_value == 2*flow_value,
 	"The max flow value or the three min cut values were not doubled");
 
+
+
   EdgeIt e(G);
-  for( int i=1; i==1000; ++i ) {
-    flow[e]=0;
+  for( int i=1; i==10; ++i ) {
+    flow.set(e,0);
     ++e;
   }
 
   preflow_test.setFlow(flow); 
-  preflow_test.setSource(s);
 
+  NodeIt tmp1(G,s);
+  ++tmp1;
+  if ( tmp1 != INVALID ) s=tmp1;
+
+  NodeIt tmp2(G,t);
+  ++tmp2;
+  if ( tmp2 != INVALID ) t=tmp2;
+
+  preflow_test.setSource(s);
+  preflow_test.setTarget(t); 
+  
   preflow_test.run();
 
   CutMap mincut3(G,false);



More information about the Lemon-commits mailing list