# HG changeset patch
# User marci
# Date 1079536188 0
# Node ID a1680b3c516cd5b0ab4e963afd54204a7ca4ad43
# Parent  84c19824322a35acd56ee2a669eb899c9bd62c29
.

diff -r 84c19824322a -r a1680b3c516c src/work/edmonds_karp.h
--- a/src/work/edmonds_karp.h	Wed Mar 17 15:01:04 2004 +0000
+++ b/src/work/edmonds_karp.h	Wed Mar 17 15:09:48 2004 +0000
@@ -532,6 +532,7 @@
   class MaxMatching {
   public:
     typedef typename Graph::Node Node;
+    typedef typename Graph::NodeIt NodeIt;
     typedef typename Graph::Edge Edge;
     typedef typename Graph::EdgeIt EdgeIt;
     typedef typename Graph::OutEdgeIt OutEdgeIt;
@@ -563,7 +564,7 @@
       typename AugGraph::NodeMap<AugEdge> pred(res_graph); 
       for(NodeIt s=G->template first<NodeIt>(); G->valid(s); G->next(s)) {
 	Number f=0;
-	for(OutEdgeIt e=G->template first<OutEdgeIt>(); G->valid(e); G->next(e))
+	for(OutEdgeIt e=G->template first<OutEdgeIt>(s); G->valid(e); G->next(e))
 	  f+=flow->get(e);
 	if (f<1) {
 	  res_bfs.pushAndSetReached(s);
@@ -586,7 +587,7 @@
 	  } else {
 	    free.set(w, res_graph.free(e)); 
 	  }
-	  if (TMap(res_graph.head(e))) { 
+	  if (T->get(res_graph.head(e))) { 
 	    n=res_graph.head(e);
 	    _augment=true; 
 	    break; 
@@ -598,7 +599,7 @@
 
       if (_augment) {
 	//Node n=t;
-	Number augment_value=free.get(t);
+	Number augment_value=free.get(n);
 	while (res_graph.valid(pred.get(n))) { 
 	  AugEdge e=pred.get(n);
 	  res_graph.augment(e, augment_value); 
@@ -805,18 +806,18 @@
 	//std::cout<<std::endl;
       } 
     }
-    template<typename MutableGraph> void run() {
-      //int num_of_augmentations=0;
-      //while (augmentOnShortestPath()) { 
-	while (augmentOnBlockingFlow<MutableGraph>()) { 
-	//std::cout << ++num_of_augmentations << " ";
-	//std::cout<<std::endl;
-      } 
-    }
+//     template<typename MutableGraph> void run() {
+//       //int num_of_augmentations=0;
+//       //while (augmentOnShortestPath()) { 
+// 	while (augmentOnBlockingFlow<MutableGraph>()) { 
+// 	//std::cout << ++num_of_augmentations << " ";
+// 	//std::cout<<std::endl;
+//       } 
+//     } 
     Number flowValue() { 
       Number a=0;
-      OutEdgeIt e;
-      for(G->/*getF*/first(e, s); G->valid(e); G->next(e)) {
+      EdgeIt e;
+      for(G->/*getF*/first(e); G->valid(e); G->next(e)) {
 	a+=flow->get(e);
       }
       return a;
diff -r 84c19824322a -r a1680b3c516c src/work/marci/makefile
--- a/src/work/marci/makefile	Wed Mar 17 15:01:04 2004 +0000
+++ b/src/work/marci/makefile	Wed Mar 17 15:09:48 2004 +0000
@@ -9,7 +9,7 @@
 CXXFLAGS = -g -O -W -Wall $(INCLUDEDIRS) -ansi -pedantic
 
 
-BINARIES = edmonds_karp_demo preflow_demo_leda lg_vs_sg leda_graph_demo leda_bfs_dfs
+BINARIES = edmonds_karp_demo preflow_demo_leda lg_vs_sg leda_graph_demo leda_bfs_dfs max_bipartite_matching_demo
 #preflow_demo_boost edmonds_karp_demo_boost preflow_demo_jacint preflow_demo_athos edmonds_karp_demo_alpar
 
 all: $(BINARIES)
@@ -28,6 +28,12 @@
 leda_graph_demo: leda_graph_demo.o
 	$(CXX3) -Wall -O -L$(LEDAROOT) -o leda_graph_demo leda_graph_demo.o -lG -lL -lm
 
+max_bipartite_matching_demo.o:
+	$(CXX3) -Wall -O -I.. -I../alpar -I$(LEDAROOT)/incl -I. -c max_bipartite_matching_demo.cc
+
+max_bipartite_matching_demo: max_bipartite_matching_demo.o
+	$(CXX3) -Wall -O -L$(LEDAROOT) -o max_bipartite_matching_demo max_bipartite_matching_demo.o -lG -lL -lm
+
 leda_bfs_dfs.o:
 	$(CXX3) -Wall -O -I.. -I../alpar -I$(LEDAROOT)/incl -I. -c leda_bfs_dfs.cc
 
diff -r 84c19824322a -r a1680b3c516c src/work/marci/max_bipartite_matching_demo.cc
--- a/src/work/marci/max_bipartite_matching_demo.cc	Wed Mar 17 15:01:04 2004 +0000
+++ b/src/work/marci/max_bipartite_matching_demo.cc	Wed Mar 17 15:09:48 2004 +0000
@@ -49,7 +49,7 @@
   typedef Graph::OutEdgeIt OutEdgeIt;
   typedef Graph::InEdgeIt InEdgeIt;
 
-  Node s, t;
+  //Node s, t;
   //Graph::EdgeMap<int> cap(G);
   //readDimacsMaxFlow(std::cin, G, s, t, cap);
   std::vector<Node> s_nodes;
@@ -65,8 +65,8 @@
   for(int i=0; i<50; ++i) {
     G.addEdge(s_nodes[random(20)], t_nodes[random(20)]);
   }
-  Graph::NodeMap<bool> s_map; //false
-  Graph::NodeMap<bool> t_map; //false
+  Graph::NodeMap<bool> s_map(G); //false
+  Graph::NodeMap<bool> t_map(G); //false
   
   for(int i=0; i<20; ++i) {
     s_map.set(s_nodes[i], true);
@@ -76,7 +76,7 @@
   {
     std::cout << "on-the-fly max bipartite matching demo on wrapped leda graph..." << std::endl;
     Graph::EdgeMap<int> flow(G); //0 flow
-    Graph::EdgeMap<int> capacity(G, 1);
+    Graph::EdgeMap<int> cap(G, 1);
 
     Timer ts;
     ts.reset();