NewMapWin has become Dialog instead of Window. Therefore it is created dynamically, when there is need for it, instead of keeping one instance in memory. This solution is slower, but more correct than before.
2 #ifndef LEMON_BENCH_TEST_H
3 #define LEMON_BENCH_TEST_H
8 #include<lemon/graph_utils.h>
9 #include<lemon/time_measure.h>
11 ///A primitive primtest
13 ///\bug 2 is not a prime according to this function!
15 ///\bug This function should go out of header file. I'm making it
17 inline bool isPrim(int n)
20 for(int k=3;n/k>=k;k+=2)
21 if(!(n%k)) return false;
27 ///Finds the smallest prime not less then \c n.
29 ///\bug This function should go out of header file. I'm making it
31 inline int nextPrim(int n)
33 for(n+=!(n%2);!isPrim(n);n+=2) ;
38 /// Class to generate consecutive primes
41 std::vector<int> primes;
46 for(int i=0;m<primes[i]*primes[i];i++) if(!(m%primes[i])) return false;
54 if(primes.size()==0) {
59 do n+=2; while(!isPrime(n));
66 inline void PrintTime(char *ID,lemon::Timer &T)
68 lemon::TimeStamp S(T);
69 std::cout << ID << ' ' << S.userTime() << ' '
70 << S.systemTime() << ' ' << S.realTime() << std::endl;
77 void addHyperCube(Graph &G,int dim,std::vector<typename Graph::Node> &nodes)
79 GRAPH_TYPEDEFS(typename Graph);
81 std::vector<int> bits(dim+1);
83 for(int i=1;i<=dim;i++) bits[i]=2*bits[i-1];
85 for(int i=0;i<bits[dim];i++) {
86 nodes.push_back(G.addNode());
87 for(int j=0;j<dim;j++) if(i&bits[j]) G.addEdge(nodes[i-bits[j]],nodes[i]);
93 void addBiDirHyperCube(Graph &G,int dim,std::vector<typename Graph::Node>&nodes)
95 GRAPH_TYPEDEFS(typename Graph);
97 std::vector<int> bits(dim+1);
99 for(int i=1;i<=dim;i++) bits[i]=2*bits[i-1];
101 for(int i=0;i<bits[dim];i++) {
102 nodes.push_back(G.addNode());
103 for(int j=0;j<dim;j++) if(i&bits[j]) {
104 G.addEdge(nodes[i-bits[j]],nodes[i]);
105 G.addEdge(nodes[i],nodes[i-bits[j]]);