Changeset 2207:75a29ac69c19 in lemon-0.x for benchmark/swap_bipartite_bench.cc
- Timestamp:
- 09/07/06 15:27:16 (17 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2933
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
benchmark/swap_bipartite_bench.cc
r2130 r2207 4 4 5 5 #include <lemon/smart_graph.h> 6 #include <lemon/list_graph.h> 6 7 7 8 #include <lemon/bpugraph_adaptor.h> … … 9 10 10 11 #include <lemon/graph_utils.h> 11 #include <lemon/ xy.h>12 #include <lemon/dim2.h> 12 13 #include <lemon/graph_to_eps.h> 13 14 … … 18 19 19 20 typedef SmartBpUGraph Graph; 21 typedef ListBpUGraph LGraph; 20 22 BPUGRAPH_TYPEDEFS(Graph); 21 23 … … 42 44 43 45 Timer nt(false), st(false); 46 Timer lnt(false), lst(false); 44 47 45 48 for (int i = 0; i < s; ++i) { 46 49 Graph graph; 50 LGraph lgraph; 47 51 vector<Node> aNodes; 48 52 vector<Node> bNodes; 53 vector<LGraph::Node> laNodes; 54 vector<LGraph::Node> lbNodes; 49 55 50 56 for (int i = 0; i < n; ++i) { 51 57 Node node = graph.addANode(); 52 58 aNodes.push_back(node); 59 LGraph::Node lnode = lgraph.addANode(); 60 laNodes.push_back(lnode); 53 61 } 54 62 for (int i = 0; i < m; ++i) { 55 63 Node node = graph.addBNode(); 56 64 bNodes.push_back(node); 65 LGraph::Node lnode = lgraph.addBNode(); 66 lbNodes.push_back(lnode); 57 67 } 58 68 for (int i = 0; i < e; ++i) { 59 Node aNode = aNodes[urandom(n)]; 60 Node bNode = bNodes[urandom(m)]; 69 int a,b; 70 Node aNode = aNodes[a=urandom(n)]; 71 Node bNode = bNodes[b=urandom(m)]; 61 72 graph.addEdge(aNode, bNode); 73 LGraph::Node laNode = laNodes[a]; 74 LGraph::Node lbNode = lbNodes[b]; 75 lgraph.addEdge(laNode, lbNode); 62 76 } 63 77 … … 82 96 st.stop(); 83 97 98 } 99 { 100 MaxBipartiteMatching<LGraph> bpmatch(lgraph); 101 102 lnt.start(); 103 bpmatch.init(); 104 bpmatch.start(); 105 lnt.stop(); 106 84 107 } 85 86 }87 108 88 cout << k * 100 << ' ' << nt.realTime() << ' ' << st.realTime() << endl; 109 { 110 typedef SwapBpUGraphAdaptor<LGraph> SGraph; 111 SGraph sgraph(lgraph); 112 MaxBipartiteMatching<SGraph> bpmatch(sgraph); 113 114 lst.start(); 115 bpmatch.init(); 116 bpmatch.start(); 117 lst.stop(); 118 119 } 120 } 121 122 cout << k * 100 << ' ' << nt.realTime() << ' ' << st.realTime() 123 << ' ' << lnt.realTime() << ' ' << lst.realTime()<< endl; 89 124 90 125 }
Note: See TracChangeset
for help on using the changeset viewer.