src/benchmark/graph-bench.cc
changeset 1435 8e85e6bbefdf
parent 1434 d8475431bbbb
child 1436 e0beb94d08bf
     1.1 --- a/src/benchmark/graph-bench.cc	Sat May 21 21:04:57 2005 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,55 +0,0 @@
     1.4 -#include<lemon/list_graph.h>
     1.5 -
     1.6 -#include"bench_tools.h"
     1.7 -
     1.8 -using namespace lemon;
     1.9 -
    1.10 -///Makes a full graph by adding and deleting a lot of edges;
    1.11 -
    1.12 -///\param n Number of nodes.
    1.13 -///\param rat The funcion will make \f$rat\timesn^2\f$ edge addition and
    1.14 -///\f$(rat-1)\timesn^2\f$ deletion.
    1.15 -///\param p Tuning parameters.
    1.16 -///\warning \c rat, \c p, and \c n must be pairwise relative primes. 
    1.17 -template <class Graph>
    1.18 -void makeFullGraph(int n, int rat, int p)
    1.19 -{
    1.20 -  GRAPH_TYPEDEF_FACTORY(Graph);
    1.21 -
    1.22 -  Graph G;
    1.23 -  
    1.24 -  //  Node nodes[n];
    1.25 -  std::vector<Node> nodes(n);
    1.26 -  for(int i=0;i<n;i++) nodes[i]=G.addNode();
    1.27 -  
    1.28 -  //Edge equ[rat];
    1.29 -  std::vector<Edge> equ(rat);
    1.30 -  
    1.31 -  long long int count;
    1.32 -  
    1.33 -  for(count=0;count<rat;count++) {
    1.34 -    equ[count%rat]=G.addEdge(nodes[(count*p)%n],nodes[(count*p/n)%n]);
    1.35 -  }
    1.36 -  for(;(count%rat)||((count*p)%n)||((count*p/n)%n);count++) {
    1.37 -    //    if(!(count%1000000)) fprintf(stderr,"%d\r",count);
    1.38 -    if(count%rat) G.erase(equ[count%rat]);
    1.39 -    equ[count%rat]=G.addEdge(nodes[(count*p)%n],nodes[(count*p/n)%n]);
    1.40 -  }
    1.41 -//   std::cout << "Added " << count
    1.42 -// 	    << " ( " << n << "^2 * " << rat << " ) edges\n";
    1.43 -
    1.44 -
    1.45 -  //  for(int i=0;1;i++) ;
    1.46 -}
    1.47 -
    1.48 -int main()
    1.49 -{
    1.50 -  lemon::Timer T;
    1.51 -  makeFullGraph<ListGraph>(nextPrim(1000),nextPrim(300),nextPrim(100));
    1.52 -  
    1.53 -  PrintTime("BIG",T);
    1.54 -  T.reset();
    1.55 -  makeFullGraph<ListGraph>(nextPrim(100),nextPrim(30000),nextPrim(150));
    1.56 -
    1.57 -  PrintTime("SMALL",T);
    1.58 -}