src/work/marci/preflow_bug.cc
changeset 986 e997802b855c
parent 921 818510fa3d99
     1.1 --- a/src/work/marci/preflow_bug.cc	Sat Nov 13 12:24:01 2004 +0000
     1.2 +++ b/src/work/marci/preflow_bug.cc	Sat Nov 13 12:53:28 2004 +0000
     1.3 @@ -45,7 +45,7 @@
     1.4    {
     1.5      Graph::EdgeIt e;
     1.6      for (g.first(e); g.valid(e); g.next(e))
     1.7 -      cout << 1+g.id(g.tail(e)) << "->" << 1+g.id(g.head(e)) << " cap: " << cap[e] << " preflow: " << flow[e] << endl;
     1.8 +      cout << 1+g.id(g.source(e)) << "->" << 1+g.id(g.target(e)) << " cap: " << cap[e] << " preflow: " << flow[e] << endl;
     1.9    }
    1.10    {
    1.11      Graph::NodeIt n;
    1.12 @@ -75,15 +75,15 @@
    1.13      
    1.14      Graph::EdgeIt e;
    1.15      for (g.first(e); g.valid(e); g.next(e)) {
    1.16 -      if (cut[g.tail(e)] && !cut[g.head(e)]) {
    1.17 -	cout << 1+g.id(g.tail(e)) << "->" << 1+g.id(g.head(e)) 
    1.18 +      if (cut[g.source(e)] && !cut[g.target(e)]) {
    1.19 +	cout << 1+g.id(g.source(e)) << "->" << 1+g.id(g.target(e)) 
    1.20  	     << "(forward edge) flow: " << flow[e] 
    1.21  	     << " cap: " << cap[e]<< endl;
    1.22  	if (flow[e]!=cap[e]) 
    1.23  	std::cout << "Slackness does not hold!" << std::endl;
    1.24        }
    1.25 -      if (!cut[g.tail(e)] && cut[g.head(e)]) {
    1.26 -	cout << 1+g.id(g.tail(e)) << "->" << 1+g.id(g.head(e)) 
    1.27 +      if (!cut[g.source(e)] && cut[g.target(e)]) {
    1.28 +	cout << 1+g.id(g.source(e)) << "->" << 1+g.id(g.target(e)) 
    1.29  	     << "(backward edge) flow: " << flow[e] << endl;
    1.30  	if (flow[e]!=0) 
    1.31  	std::cout << "Slackness does not hold!" << std::endl;
    1.32 @@ -105,9 +105,9 @@
    1.33  //     max_flow_test.actMinCut(cut);
    1.34  
    1.35  //     FOR_EACH_LOC(Graph::EdgeIt, e, g) {
    1.36 -//       if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e]) 
    1.37 +//       if (cut[g.source(e)] && !cut[g.target(e)] && !flow[e]==cap[e]) 
    1.38  // 	std::cout << "Slackness does not hold!" << std::endl;
    1.39 -//       if (!cut[g.tail(e)] && cut[g.head(e)] && flow[e]>0) 
    1.40 +//       if (!cut[g.source(e)] && cut[g.target(e)] && flow[e]>0) 
    1.41  // 	std::cout << "Slackness does not hold!" << std::endl;
    1.42  //     }
    1.43  //   }
    1.44 @@ -121,9 +121,9 @@
    1.45  //     std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
    1.46  
    1.47  //     FOR_EACH_LOC(Graph::EdgeIt, e, g) {
    1.48 -//       if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e]) 
    1.49 +//       if (cut[g.source(e)] && !cut[g.target(e)] && !flow[e]==cap[e]) 
    1.50  // 	std::cout << "Slackness does not hold!" << std::endl;
    1.51 -//       if (!cut[g.tail(e)] && cut[g.head(e)] && flow[e]>0) 
    1.52 +//       if (!cut[g.source(e)] && cut[g.target(e)] && flow[e]>0) 
    1.53  // 	std::cout << "Slackness does not hold!" << std::endl;
    1.54  //     }
    1.55  //   }
    1.56 @@ -148,9 +148,9 @@
    1.57  //     std::cout << "flow value: "<< augmenting_flow_test.flowValue() << std::endl;
    1.58  
    1.59  //     FOR_EACH_LOC(Graph::EdgeIt, e, g) {
    1.60 -//       if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e]) 
    1.61 +//       if (cut[g.source(e)] && !cut[g.target(e)] && !flow[e]==cap[e]) 
    1.62  // 	std::cout << "Slackness does not hold!" << std::endl;
    1.63 -//       if (!cut[g.tail(e)] && cut[g.head(e)] && flow[e]>0) 
    1.64 +//       if (!cut[g.source(e)] && cut[g.target(e)] && flow[e]>0) 
    1.65  // 	std::cout << "Slackness does not hold!" << std::endl;
    1.66  //     }
    1.67  //   }
    1.68 @@ -177,9 +177,9 @@
    1.69  //     std::cout << "flow value: "<< augmenting_flow_test.flowValue() << std::endl;
    1.70  
    1.71  //     FOR_EACH_LOC(Graph::EdgeIt, e, g) {
    1.72 -//       if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e]) 
    1.73 +//       if (cut[g.source(e)] && !cut[g.target(e)] && !flow[e]==cap[e]) 
    1.74  // 	std::cout << "Slackness does not hold!" << std::endl;
    1.75 -//       if (!cut[g.tail(e)] && cut[g.head(e)] && flow[e]>0) 
    1.76 +//       if (!cut[g.source(e)] && cut[g.target(e)] && flow[e]>0) 
    1.77  // 	std::cout << "Slackness does not hold!" << std::endl;
    1.78  //     }
    1.79  //   }
    1.80 @@ -195,9 +195,9 @@
    1.81  //     std::cout << "flow value: "<< augmenting_flow_test.flowValue() << std::endl;
    1.82  
    1.83  //     FOR_EACH_LOC(Graph::EdgeIt, e, g) {
    1.84 -//       if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e]) 
    1.85 +//       if (cut[g.source(e)] && !cut[g.target(e)] && !flow[e]==cap[e]) 
    1.86  // 	std::cout << "Slackness does not hold!" << std::endl;
    1.87 -//       if (!cut[g.tail(e)] && cut[g.head(e)] && flow[e]>0) 
    1.88 +//       if (!cut[g.source(e)] && cut[g.target(e)] && flow[e]>0) 
    1.89  // 	std::cout << "Slackness does not hold!" << std::endl;
    1.90  //     }
    1.91  //   }
    1.92 @@ -213,9 +213,9 @@
    1.93  //     std::cout << "flow value: "<< augmenting_flow_test.flowValue() << std::endl;
    1.94  
    1.95  //     FOR_EACH_LOC(Graph::EdgeIt, e, g) {
    1.96 -//       if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e]) 
    1.97 +//       if (cut[g.source(e)] && !cut[g.target(e)] && !flow[e]==cap[e]) 
    1.98  // 	std::cout << "Slackness does not hold!" << std::endl;
    1.99 -//       if (!cut[g.tail(e)] && cut[g.head(e)] && flow[e]>0) 
   1.100 +//       if (!cut[g.source(e)] && cut[g.target(e)] && flow[e]>0) 
   1.101  // 	std::cout << "Slackness does not hold!" << std::endl;
   1.102  //     }
   1.103  //   }