# HG changeset patch # User alpar # Date 1160654011 0 # Node ID 18c24fe93b99ab4cfc880563dc4babd7b3afde0e # Parent 8d623100ab131e9adb6e00396121a730038a2863 Turn off 32bit specific tests. diff -r 8d623100ab13 -r 18c24fe93b99 benchmark/edge_lookup_test.h --- a/benchmark/edge_lookup_test.h Thu Oct 12 11:09:17 2006 +0000 +++ b/benchmark/edge_lookup_test.h Thu Oct 12 11:53:31 2006 +0000 @@ -189,92 +189,92 @@ }; - template - class EdgeLookUp4 - { - public: - GRAPH_TYPEDEFS(typename G) - typedef G Graph; +// template +// class EdgeLookUp4 +// { +// public: +// GRAPH_TYPEDEFS(typename G) +// typedef G Graph; - private: - const Graph &_g; - typename Graph::template NodeMap _start; - typename Graph::template NodeMap _end; - std::vector _edges; +// private: +// const Graph &_g; +// typename Graph::template NodeMap _start; +// typename Graph::template NodeMap _end; +// std::vector _edges; - class EdgeLess { - const Graph &g; - public: - EdgeLess(const Graph &_g) : g(_g) {} - bool operator()(Edge a,Edge b) const - { - return g.target(a)::iterator ei=_edges.end(); - _end[n]=_edges.size(); - std::sort(_edges.begin()+bi,ei,EdgeLess(_g)); - } - ///Refresh the full data structure. - void refresh() - { - _edges.resize(countEdges(_g)); - int l=0; - for(NodeIt n(_g);n!=INVALID;++n) - { - int ls = l; - _start[n]=&(_edges[l]); - for(OutEdgeIt e(_g,n);e!=INVALID;++e) _edges[l++]=e; - _end[n]=&(_edges[l]); - std::sort(_edges.begin()+ls,_edges.begin()+l,EdgeLess(_g)); - } +// public: +// ///Refresh the data structure at a node. +// void refresh(Node n) +// { +// const int bi = _start[n] = _edges.size(); +// for(OutEdgeIt e(_g,n);e!=INVALID;++e) _edges.push_back(e); +// const typename std::vector::iterator ei=_edges.end(); +// _end[n]=_edges.size(); +// std::sort(_edges.begin()+bi,ei,EdgeLess(_g)); +// } +// ///Refresh the full data structure. +// void refresh() +// { +// _edges.resize(countEdges(_g)); +// int l=0; +// for(NodeIt n(_g);n!=INVALID;++n) +// { +// int ls = l; +// _start[n]=&(_edges[l]); +// for(OutEdgeIt e(_g,n);e!=INVALID;++e) _edges[l++]=e; +// _end[n]=&(_edges[l]); +// std::sort(_edges.begin()+ls,_edges.begin()+l,EdgeLess(_g)); +// } - } +// } - ///Find an edge between two nodes. +// ///Find an edge between two nodes. - ///Find an edge between two nodes. - ///\param s The source node - ///\param t The target node - ///\return An edge from \c s to \c t if there exists, - ///\ref INVALID otherwise. +// ///Find an edge between two nodes. +// ///\param s The source node +// ///\param t The target node +// ///\return An edge from \c s to \c t if there exists, +// ///\ref INVALID otherwise. - Edge operator()(Node s, Node t) - { - Edge *a=_start[s]; - Edge *b=_end[s]; - while(a!=b) - { - Edge *m=(Edge*)(((unsigned int)a+(unsigned int)b)/2 & 0xfffffffc); - Node tt = _g.target(*m); - if(tt==t) return *m; - else if(tt #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; }