# HG changeset patch # User marci # Date 1093460157 0 # Node ID ce9438c5a82d7495e8f32a95ef45c34f9bc02f55 # Parent f56eb959dd39a70bb18c4336bfacf95e0ebec25c bug fix, test... diff -r f56eb959dd39 -r ce9438c5a82d src/hugo/max_flow.h --- a/src/hugo/max_flow.h Tue Aug 24 09:50:33 2004 +0000 +++ b/src/hugo/max_flow.h Wed Aug 25 18:55:57 2004 +0000 @@ -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]; diff -r f56eb959dd39 -r ce9438c5a82d src/work/makefile --- a/src/work/makefile Tue Aug 24 09:50:33 2004 +0000 +++ b/src/work/makefile Wed Aug 25 18:55:57 2004 +0000 @@ -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 diff -r f56eb959dd39 -r ce9438c5a82d src/work/marci/bfsit_vs_byhand.cc --- a/src/work/marci/bfsit_vs_byhand.cc Tue Aug 24 09:50:33 2004 +0000 +++ b/src/work/marci/bfsit_vs_byhand.cc Wed Aug 25 18:55:57 2004 +0000 @@ -3,7 +3,7 @@ #include #include -//#include +#include #include #include //#include @@ -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 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 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 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 > bfs(g); diff -r f56eb959dd39 -r ce9438c5a82d src/work/marci/graph_wrapper_time.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/work/marci/graph_wrapper_time.cc Wed Aug 25 18:55:57 2004 +0000 @@ -0,0 +1,76 @@ +// -*- c++ -*- + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace hugo; + +using std::cout; +using std::endl; + +template +void timeTest(std::string str, Graph& g) { + g.clear(); + typename Graph::Node s; + typename Graph::Node t; + typedef typename Graph::template EdgeMap 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 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(in, g); + typedef GraphWrapper 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(in, g1); + typedef GraphWrapper Graph2; + Graph2 g2(g1); + timeTest(in, g2); + typedef GraphWrapper Graph3; + Graph3 g3(g2); + timeTest(in, g3); +// typedef GraphWrapper Graph4; +// Graph4 g4(g3); +// timeTest(in, g4); +// typedef GraphWrapper Graph5; +// Graph5 g5(g4); +// timeTest(in, g5); +// typedef GraphWrapper Graph6; +// Graph6 g6(g5); +// timeTest(in, g6); +// typedef GraphWrapper Graph7; +// Graph7 g7(g6); +// timeTest(in, g7); + + return 0; +} diff -r f56eb959dd39 -r ce9438c5a82d src/work/marci/makefile --- a/src/work/marci/makefile Tue Aug 24 09:50:33 2004 +0000 +++ b/src/work/marci/makefile Wed Aug 25 18:55:57 2004 +0000 @@ -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