1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/work/marci/graph_wrapper_time.cc Wed Aug 25 18:55:57 2004 +0000
1.3 @@ -0,0 +1,76 @@
1.4 +// -*- c++ -*-
1.5 +
1.6 +#include <iostream>
1.7 +#include <fstream>
1.8 +#include <string>
1.9 +#include <vector>
1.10 +#include <hugo/invalid.h>
1.11 +#include <hugo/time_measure.h>
1.12 +#include <hugo/graph_wrapper.h>
1.13 +#include <hugo/max_flow.h>
1.14 +#include <hugo/dimacs.h>
1.15 +#include <hugo/list_graph.h>
1.16 +
1.17 +using namespace hugo;
1.18 +
1.19 +using std::cout;
1.20 +using std::endl;
1.21 +
1.22 +template<typename Graph>
1.23 +void timeTest(std::string str, Graph& g) {
1.24 + g.clear();
1.25 + typename Graph::Node s;
1.26 + typename Graph::Node t;
1.27 + typedef typename Graph::template EdgeMap<int> FlowMap;
1.28 + FlowMap cap(g);
1.29 + FlowMap flow(g);
1.30 + std::ifstream is(str.c_str());
1.31 + readDimacs(is, g, cap, s, t);
1.32 + Timer ts;
1.33 + ts.reset();
1.34 + cout << g.nodeNum() << endl;
1.35 + cout << g.edgeNum() << endl;
1.36 + typedef MaxFlow<Graph, int, FlowMap, FlowMap> MyMaxFlow;
1.37 + MyMaxFlow max_flow(g, s, t, cap, flow);
1.38 + max_flow.run(MyMaxFlow::NO_FLOW);
1.39 + cout << ts << endl;
1.40 +}
1.41 +
1.42 +int main(int, char** argv) {
1.43 + std::string in=argv[1];
1.44 +
1.45 + typedef ListGraph Graph;
1.46 + Graph g;
1.47 +// cout << g.id(g.addNode()) << endl;
1.48 +// cout << g.id(g.addNode()) << endl;
1.49 +// cout << g.nodeNum() << endl;
1.50 + timeTest<Graph>(in, g);
1.51 + typedef GraphWrapper<Graph> Graph1;
1.52 + Graph1 g1(g);
1.53 +// g1.clear();
1.54 +// cout << g.id(g1.addNode()) << endl;
1.55 +// cout << g.id(g1.addNode()) << endl;
1.56 +// cout << g1.nodeNum() << endl;
1.57 +// g1.clear();
1.58 + timeTest<Graph1>(in, g1);
1.59 + typedef GraphWrapper<Graph1> Graph2;
1.60 + Graph2 g2(g1);
1.61 + timeTest<Graph2>(in, g2);
1.62 + typedef GraphWrapper<Graph2> Graph3;
1.63 + Graph3 g3(g2);
1.64 + timeTest<Graph3>(in, g3);
1.65 +// typedef GraphWrapper<Graph3> Graph4;
1.66 +// Graph4 g4(g3);
1.67 +// timeTest<Graph4>(in, g4);
1.68 +// typedef GraphWrapper<Graph4> Graph5;
1.69 +// Graph5 g5(g4);
1.70 +// timeTest<Graph5>(in, g5);
1.71 +// typedef GraphWrapper<Graph5> Graph6;
1.72 +// Graph6 g6(g5);
1.73 +// timeTest<Graph6>(in, g6);
1.74 +// typedef GraphWrapper<Graph6> Graph7;
1.75 +// Graph7 g7(g6);
1.76 +// timeTest<Graph7>(in, g7);
1.77 +
1.78 + return 0;
1.79 +}