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