.
authormarci
Wed, 17 Mar 2004 16:10:33 +0000
changeset 1968a9b9360463e
parent 195 19f8bd411014
child 197 fff43d9c7110
.
src/work/edmonds_karp.h
src/work/marci/makefile
src/work/marci/max_bipartite_matching_demo.cc
     1.1 --- a/src/work/edmonds_karp.h	Wed Mar 17 15:41:00 2004 +0000
     1.2 +++ b/src/work/edmonds_karp.h	Wed Mar 17 16:10:33 2004 +0000
     1.3 @@ -563,12 +563,14 @@
     1.4        BfsIterator5< AugGraph, /*AugOutEdgeIt,*/ ReachedMap > res_bfs(res_graph);
     1.5        typename AugGraph::NodeMap<AugEdge> pred(res_graph); 
     1.6        for(NodeIt s=G->template first<NodeIt>(); G->valid(s); G->next(s)) {
     1.7 -	Number f=0;
     1.8 -	for(OutEdgeIt e=G->template first<OutEdgeIt>(s); G->valid(e); G->next(e))
     1.9 -	  f+=flow->get(e);
    1.10 -	if (f<1) {
    1.11 -	  res_bfs.pushAndSetReached(s);
    1.12 -	  pred.set(s, AugEdge(INVALID));
    1.13 +	if (S->get(s)) {
    1.14 +	  Number f=0;
    1.15 +	  for(OutEdgeIt e=G->template first<OutEdgeIt>(s); G->valid(e); G->next(e))
    1.16 +	    f+=flow->get(e);
    1.17 +	  if (f<1) {
    1.18 +	    res_bfs.pushAndSetReached(s);
    1.19 +	    pred.set(s, AugEdge(INVALID));
    1.20 +	  }
    1.21  	}
    1.22        }
    1.23        
     2.1 --- a/src/work/marci/makefile	Wed Mar 17 15:41:00 2004 +0000
     2.2 +++ b/src/work/marci/makefile	Wed Mar 17 16:10:33 2004 +0000
     2.3 @@ -3,14 +3,14 @@
     2.4  #CXX3.3 = g++
     2.5  CXX3 := $(shell type -p g++-3.3 || type -p g++-3.2 || type -p g++-3.0 || type -p g++-3 || echo g++)
     2.6  #CXXFLAGS = -W -Wall -ansi -pedantic -I. -I.. -I../alpar
     2.7 -LEDAROOT ?= /ledasrc/LEDA-4.1
     2.8 +#LEDAROOT ?= /ledasrc/LEDA-4.1
     2.9  BOOSTROOT ?= /home/marci/boost
    2.10  INCLUDEDIRS ?= -I../../include -I.. -I. -I../{marci,jacint,alpar,klao,akos,athos} -I$(LEDAROOT)/incl -I$(BOOSTROOT)
    2.11  CXXFLAGS = -g -O -W -Wall $(INCLUDEDIRS) -ansi -pedantic
    2.12  
    2.13 -
    2.14 -BINARIES = edmonds_karp_demo preflow_demo_leda lg_vs_sg leda_graph_demo leda_bfs_dfs max_bipartite_matching_demo
    2.15 -#preflow_demo_boost edmonds_karp_demo_boost preflow_demo_jacint preflow_demo_athos edmonds_karp_demo_alpar
    2.16 +LEDABINARIES = lg_vs_sg leda_graph_demo leda_bfs_dfs
    2.17 +BINARIES = edmonds_karp_demo max_bipartite_matching_demo
    2.18 +#preflow_demo_boost edmonds_karp_demo_boost preflow_demo_jacint preflow_demo_athos edmonds_karp_demo_alpar preflow_demo_leda
    2.19  
    2.20  all: $(BINARIES)
    2.21  
     3.1 --- a/src/work/marci/max_bipartite_matching_demo.cc	Wed Mar 17 15:41:00 2004 +0000
     3.2 +++ b/src/work/marci/max_bipartite_matching_demo.cc	Wed Mar 17 16:10:33 2004 +0000
     3.3 @@ -4,8 +4,9 @@
     3.4  #include <vector>
     3.5  #include <cstdlib>
     3.6  
     3.7 -#include <LEDA/graph.h>
     3.8 -#include <leda_graph_wrapper.h>
     3.9 +//#include <LEDA/graph.h>
    3.10 +//#include <leda_graph_wrapper.h>
    3.11 +#include <list_graph.h>
    3.12  #include <dimacs.h>
    3.13  #include <time_measure.h>
    3.14  #include <edmonds_karp.h>
    3.15 @@ -38,9 +39,11 @@
    3.16  using std::endl;
    3.17  
    3.18  int main() {
    3.19 -  leda::graph g;
    3.20 -  typedef LedaGraphWrapper<leda::graph> Graph;
    3.21 -  Graph G(g);
    3.22 +//   leda::graph g;
    3.23 +//   typedef LedaGraphWrapper<leda::graph> Graph;
    3.24 +//   Graph G(g);
    3.25 +  typedef ListGraph Graph;
    3.26 +  Graph G;
    3.27  
    3.28    typedef Graph::Node Node;
    3.29    typedef Graph::NodeIt NodeIt;  
    3.30 @@ -61,17 +64,17 @@
    3.31    for(int i=0; i<4; ++i) {
    3.32      t_nodes.push_back(G.addNode());
    3.33    }
    3.34 -//   random_init();
    3.35 -//   for(int i=0; i<6; ++i) {
    3.36 -//     G.addEdge(s_nodes[random(4)], t_nodes[random(4)]);
    3.37 -//   }
    3.38 +  random_init();
    3.39 +  for(int i=0; i<6; ++i) {
    3.40 +    G.addEdge(s_nodes[random(4)], t_nodes[random(4)]);
    3.41 +  }
    3.42    
    3.43 -  G.addEdge(s_nodes[2], t_nodes[4-4]);
    3.44 -  G.addEdge(s_nodes[2], t_nodes[7-4]);
    3.45 -  G.addEdge(s_nodes[2], t_nodes[4-4]);
    3.46 -  G.addEdge(s_nodes[3], t_nodes[6-4]);
    3.47 -  G.addEdge(s_nodes[3], t_nodes[5-4]);
    3.48 -  G.addEdge(s_nodes[3], t_nodes[5-4]);
    3.49 +//   G.addEdge(s_nodes[2], t_nodes[4-4]);
    3.50 +//   G.addEdge(s_nodes[2], t_nodes[7-4]);
    3.51 +//   G.addEdge(s_nodes[2], t_nodes[4-4]);
    3.52 +//   G.addEdge(s_nodes[3], t_nodes[6-4]);
    3.53 +//   G.addEdge(s_nodes[3], t_nodes[5-4]);
    3.54 +//   G.addEdge(s_nodes[3], t_nodes[5-4]);
    3.55  
    3.56  
    3.57    Graph::NodeMap<bool> s_map(G); //false