Several bugfixes
authoralpar
Mon, 16 Feb 2004 16:27:49 +0000
changeset 80629b9ca9184b
parent 79 c7d834680e9b
child 81 6c8adcd6b482
Several bugfixes
src/work/alpar/f_ed_ka.h
     1.1 --- a/src/work/alpar/f_ed_ka.h	Mon Feb 16 16:21:22 2004 +0000
     1.2 +++ b/src/work/alpar/f_ed_ka.h	Mon Feb 16 16:27:49 2004 +0000
     1.3 @@ -75,32 +75,32 @@
     1.4      if(!visited.get(t)) return flow_val;
     1.5  
     1.6      // Augmenting value computation
     1.7 -    aug_val = visited.get(t)==2 ?
     1.8 +    aug_val = visited.get(t)==1 ?
     1.9        c.get(tree.get(t))-f.get(tree.get(t)) : f.get(tree.get(t));
    1.10      //FIXME: I would need 'G.opposite(e,n)'
    1.11 -    gn = visited.get(t)==2 ? G.from(tree.get(t)) : G.to(tree.get(t));
    1.12 -    while(gn!=s) if(visited.get(gn)==2)
    1.13 +    gn = visited.get(t)==1 ? G.tail(tree.get(t)) : G.head(tree.get(t));
    1.14 +    while(gn!=s) if(visited.get(gn)==1)
    1.15        {
    1.16  	//FIXME: nonstandars. gcc extension!
    1.17  	aug_val <?= c.get(tree.get(gn))-f.get(tree.get(gn));
    1.18 -	gn=G.from(tree.get(gn));
    1.19 +	gn=G.tail(tree.get(gn));
    1.20        }
    1.21      else {
    1.22        //FIXME: nonstandars. gcc extension!
    1.23        aug_val <?= f.get(tree.get(gn));
    1.24 -      gn=G.from(tree.get(gn));
    1.25 +      gn=G.head(tree.get(gn));
    1.26      }
    1.27  	
    1.28      // The augmentation itself
    1.29      gn = t;
    1.30 -    while(gn!=s) if(visited.get(gn)==2)
    1.31 +    while(gn!=s) if(visited.get(gn)==1)
    1.32        {
    1.33  	f.set(tree.get(gn),f.get(tree.get(gn))+aug_val);
    1.34 -	gn=G.from(tree.get(gn));
    1.35 +	gn=G.tail(tree.get(gn));
    1.36        }
    1.37      else {
    1.38        f.set(tree.get(gn),f.get(tree.get(gn))-aug_val);
    1.39 -      gn=G.from(tree.get(gn));
    1.40 +      gn=G.head(tree.get(gn));
    1.41      }
    1.42  
    1.43      flow_val+=aug_val;