diff -r 8d623100ab13 -r 18c24fe93b99 benchmark/swap_bipartite_bench.cc --- a/benchmark/swap_bipartite_bench.cc Thu Oct 12 11:09:17 2006 +0000 +++ b/benchmark/swap_bipartite_bench.cc Thu Oct 12 11:53:31 2006 +0000 @@ -3,6 +3,7 @@ #include #include +#include #include #include @@ -16,6 +17,7 @@ using namespace lemon; typedef SmartBpUGraph Graph; +typedef ListBpUGraph LGraph; BPUGRAPH_TYPEDEFS(Graph); int _urandom_init() { @@ -40,24 +42,36 @@ int s = 100; Timer nt(false), st(false); + Timer lnt(false), lst(false); for (int i = 0; i < s; ++i) { Graph graph; + LGraph lgraph; vector aNodes; vector bNodes; + vector laNodes; + vector lbNodes; for (int i = 0; i < n; ++i) { Node node = graph.addANode(); aNodes.push_back(node); + LGraph::Node lnode = lgraph.addANode(); + laNodes.push_back(lnode); } for (int i = 0; i < m; ++i) { Node node = graph.addBNode(); bNodes.push_back(node); + LGraph::Node lnode = lgraph.addBNode(); + lbNodes.push_back(lnode); } for (int i = 0; i < e; ++i) { - Node aNode = aNodes[urandom(n)]; - Node bNode = bNodes[urandom(m)]; + int a,b; + Node aNode = aNodes[a=urandom(n)]; + Node bNode = bNodes[b=urandom(m)]; graph.addEdge(aNode, bNode); + LGraph::Node laNode = laNodes[a]; + LGraph::Node lbNode = lbNodes[b]; + lgraph.addEdge(laNode, lbNode); } { @@ -80,11 +94,32 @@ bpmatch.start(); st.stop(); + } + { + MaxBipartiteMatching bpmatch(lgraph); + + lnt.start(); + bpmatch.init(); + bpmatch.start(); + lnt.stop(); + } - - } - cout << k * 100 << ' ' << nt.realTime() << ' ' << st.realTime() << endl; + { + typedef SwapBpUGraphAdaptor SGraph; + SGraph sgraph(lgraph); + MaxBipartiteMatching bpmatch(sgraph); + + lst.start(); + bpmatch.init(); + bpmatch.start(); + lst.stop(); + + } + } + + cout << k * 100 << ' ' << nt.realTime() << ' ' << st.realTime() + << ' ' << lnt.realTime() << ' ' << lst.realTime()<< endl; }