COIN-OR::LEMON - Graph Library

Changeset 2207:75a29ac69c19 in lemon-0.x for benchmark


Ignore:
Timestamp:
09/07/06 15:27:16 (18 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2933
Message:

xy -> dim2::Point

File:
1 edited

Legend:

Unmodified
Added
Removed
  • benchmark/swap_bipartite_bench.cc

    r2130 r2207  
    44
    55#include <lemon/smart_graph.h>
     6#include <lemon/list_graph.h>
    67
    78#include <lemon/bpugraph_adaptor.h>
     
    910
    1011#include <lemon/graph_utils.h>
    11 #include <lemon/xy.h>
     12#include <lemon/dim2.h>
    1213#include <lemon/graph_to_eps.h>
    1314
     
    1819
    1920typedef SmartBpUGraph Graph;
     21typedef ListBpUGraph LGraph;
    2022BPUGRAPH_TYPEDEFS(Graph);
    2123
     
    4244   
    4345    Timer nt(false), st(false);
     46    Timer lnt(false), lst(false);
    4447   
    4548    for (int i = 0; i < s; ++i) {
    4649      Graph graph;
     50      LGraph lgraph;
    4751      vector<Node> aNodes;
    4852      vector<Node> bNodes; 
     53      vector<LGraph::Node> laNodes;
     54      vector<LGraph::Node> lbNodes; 
    4955     
    5056      for (int i = 0; i < n; ++i) {
    5157        Node node = graph.addANode();
    5258        aNodes.push_back(node);
     59        LGraph::Node lnode = lgraph.addANode();
     60        laNodes.push_back(lnode);
    5361      }
    5462      for (int i = 0; i < m; ++i) {
    5563        Node node = graph.addBNode();
    5664        bNodes.push_back(node);
     65        LGraph::Node lnode = lgraph.addBNode();
     66        lbNodes.push_back(lnode);
    5767      }
    5868      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)];
    6172        graph.addEdge(aNode, bNode);
     73        LGraph::Node laNode = laNodes[a];
     74        LGraph::Node lbNode = lbNodes[b];
     75        lgraph.addEdge(laNode, lbNode);
    6276      }
    6377
     
    8296        st.stop();
    8397       
     98      }                 
     99      {
     100        MaxBipartiteMatching<LGraph> bpmatch(lgraph);
     101       
     102        lnt.start();
     103        bpmatch.init();
     104        bpmatch.start();
     105        lnt.stop();
     106       
    84107      }
    85                  
    86     }
    87108
    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;
    89124
    90125  }
Note: See TracChangeset for help on using the changeset viewer.