[Lemon-commits] [lemon_svn] marci: r1043 - in hugo/trunk/src: hugo work work/marci

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


Author: marci
Date: Wed Aug 25 20:55:57 2004
New Revision: 1043

Added:
   hugo/trunk/src/work/marci/graph_wrapper_time.cc
Modified:
   hugo/trunk/src/hugo/max_flow.h
   hugo/trunk/src/work/makefile
   hugo/trunk/src/work/marci/bfsit_vs_byhand.cc
   hugo/trunk/src/work/marci/makefile

Log:
bug fix, test...


Modified: hugo/trunk/src/hugo/max_flow.h
==============================================================================
--- hugo/trunk/src/hugo/max_flow.h	(original)
+++ hugo/trunk/src/hugo/max_flow.h	Wed Aug 25 20:55:57 2004
@@ -838,7 +838,8 @@
 
 	    //putting the active nodes into the stack
 	    int lev=level[w];
-	    if ( exc > 0 && lev < n && w != t ) 
+	    if ( exc > 0 && lev < n && Node(w) != t ) 
+///\bug	    if ( exc > 0 && lev < n && w != t ) tempararily for working with wrappers. in hugo 0.2 it will work. Amugy mukodik sage_graph-fal, de smart_graph-fal nem, azt hozzatennem.
 	      {
 		next.set(w,first[lev]);
 		first[lev]=w;
@@ -855,7 +856,7 @@
 		 NNMap& right, int& b, int& k, bool what_heur )
     {
 
-      Num lev=level[w];
+      int lev=level[w];
 
       Node right_n=right[w];
       Node left_n=left[w];

Modified: hugo/trunk/src/work/makefile
==============================================================================
--- hugo/trunk/src/work/makefile	(original)
+++ hugo/trunk/src/work/makefile	Wed Aug 25 20:55:57 2004
@@ -1,5 +1,5 @@
 INCLUDEDIRS ?= -I.. -I. -I./{marci,jacint,alpar,klao,akos}
-CXXFLAGS = -g -O2 -W -Wall $(INCLUDEDIRS) -ansi -pedantic
+CXXFLAGS = -g -O3 -W -Wall $(INCLUDEDIRS) -ansi -pedantic
 
 BINARIES ?= bin_heap_demo
 

Modified: hugo/trunk/src/work/marci/bfsit_vs_byhand.cc
==============================================================================
--- hugo/trunk/src/work/marci/bfsit_vs_byhand.cc	(original)
+++ hugo/trunk/src/work/marci/bfsit_vs_byhand.cc	Wed Aug 25 20:55:57 2004
@@ -3,7 +3,7 @@
 #include <fstream>
 
 #include <sage_graph.h>
-//#include <smart_graph.h>
+#include <hugo/smart_graph.h>
 #include <hugo/dimacs.h>
 #include <hugo/time_measure.h>
 //#include <hugo/for_each_macros.h>
@@ -11,6 +11,9 @@
 
 using namespace hugo;
 
+using std::cout;
+using std::endl;
+
 int main() {
   typedef SageGraph Graph; 
   typedef Graph::Node Node;
@@ -20,12 +23,18 @@
   typedef Graph::OutEdgeIt OutEdgeIt;
 
   Graph g;
-  Node s, t;
+  //Node s;
   //Graph::EdgeMap<int> cap(g);
   //readDimacsMaxFlow(std::cin, g, s, t, cap);
   readDimacs(std::cin, g);
+  NodeIt s;
+  g.first(s);
+
+  cout << g.nodeNum() << endl;
+  cout << g.edgeNum() << endl;
 
   Graph::NodeMap<OutEdgeIt> pred(g);
+  cout << "iteration time of bfs written by hand..." << endl;
   Timer ts;
   {
     ts.reset();
@@ -33,7 +42,7 @@
     reached.set(s, true);
     pred.set(s, INVALID);
     std::queue<Node> bfs_queue;
-    bfs_queue.push(t);
+    bfs_queue.push(s);
     while (!bfs_queue.empty()) {
       Node v=bfs_queue.front();	
       bfs_queue.pop();
@@ -51,6 +60,7 @@
     std::cout << ts << std::endl;
   }
 
+  cout << "iteration time with bfs iterator..." << endl;
   {
     ts.reset();      
     BfsIterator< Graph, Graph::NodeMap<bool> > bfs(g);

Added: hugo/trunk/src/work/marci/graph_wrapper_time.cc
==============================================================================
--- (empty file)
+++ hugo/trunk/src/work/marci/graph_wrapper_time.cc	Wed Aug 25 20:55:57 2004
@@ -0,0 +1,76 @@
+// -*- c++ -*-
+
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <vector>
+#include <hugo/invalid.h>
+#include <hugo/time_measure.h>
+#include <hugo/graph_wrapper.h>
+#include <hugo/max_flow.h>
+#include <hugo/dimacs.h>
+#include <hugo/list_graph.h>
+
+using namespace hugo;
+
+using std::cout;
+using std::endl;
+
+template<typename Graph>
+void timeTest(std::string str, Graph& g) {
+  g.clear();
+  typename Graph::Node s;
+  typename Graph::Node t;
+  typedef typename Graph::template EdgeMap<int> FlowMap;
+  FlowMap cap(g);
+  FlowMap flow(g);
+  std::ifstream is(str.c_str());
+  readDimacs(is, g, cap, s, t);
+  Timer ts;
+  ts.reset();
+  cout << g.nodeNum() << endl;
+  cout << g.edgeNum() << endl;
+  typedef MaxFlow<Graph, int, FlowMap, FlowMap> MyMaxFlow;
+  MyMaxFlow max_flow(g, s, t, cap, flow);
+  max_flow.run(MyMaxFlow::NO_FLOW);
+  cout << ts << endl;
+}
+
+int main(int, char** argv) {
+   std::string in=argv[1];
+
+  typedef ListGraph Graph; 
+  Graph g;
+//   cout << g.id(g.addNode()) << endl;
+//   cout << g.id(g.addNode()) << endl;
+//   cout << g.nodeNum() << endl;
+  timeTest<Graph>(in, g);
+  typedef GraphWrapper<Graph> Graph1;
+  Graph1 g1(g);
+//   g1.clear();
+//   cout << g.id(g1.addNode()) << endl;
+//   cout << g.id(g1.addNode()) << endl;
+//   cout << g1.nodeNum() << endl;
+//   g1.clear();
+  timeTest<Graph1>(in, g1);
+  typedef GraphWrapper<Graph1> Graph2;
+  Graph2 g2(g1);
+  timeTest<Graph2>(in, g2);
+  typedef GraphWrapper<Graph2> Graph3;
+  Graph3 g3(g2);
+  timeTest<Graph3>(in, g3);
+//   typedef GraphWrapper<Graph3> Graph4;
+//   Graph4 g4(g3);
+//   timeTest<Graph4>(in, g4);
+//   typedef GraphWrapper<Graph4> Graph5;
+//   Graph5 g5(g4);
+//   timeTest<Graph5>(in, g5);
+//   typedef GraphWrapper<Graph5> Graph6;
+//   Graph6 g6(g5);
+//   timeTest<Graph6>(in, g6);  
+//   typedef GraphWrapper<Graph6> Graph7;
+//   Graph7 g7(g6);
+//   timeTest<Graph7>(in, g7);
+
+  return 0;
+}

Modified: hugo/trunk/src/work/marci/makefile
==============================================================================
--- hugo/trunk/src/work/marci/makefile	(original)
+++ hugo/trunk/src/work/marci/makefile	Wed Aug 25 20:55:57 2004
@@ -4,7 +4,7 @@
 INCLUDEDIRS ?= -I../{jacint,marci,alpar,klao,akos,athos} -I../.. -I.. -I$(BOOSTROOT)
 
 LEDABINARIES = leda_graph_demo leda_bfs_dfs max_bipartite_matching_demo
-BINARIES = max_flow_demo iterator_bfs_demo macro_test lg_vs_sg_vs_sg bfsit_vs_byhand bipartite_graph_wrapper_test bipartite_matching_demo top_sort_test max_flow_1
+BINARIES = graph_wrapper_time max_flow_demo iterator_bfs_demo macro_test lg_vs_sg_vs_sg bfsit_vs_byhand bipartite_graph_wrapper_test bipartite_matching_demo top_sort_test max_flow_1 proba7
 #BINARIES = preflow_bug
 #gw_vs_not preflow_demo_boost edmonds_karp_demo_boost preflow_demo_jacint preflow_demo_athos edmonds_karp_demo_alpar preflow_demo_leda
 



More information about the Lemon-commits mailing list