EdgeLookUp and AllEdgeLookUp tests added.
3 * This file is a part of LEMON, a generic C++ optimization library
5 * Copyright (C) 2003-2006
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
9 * Permission to use, modify and distribute this software is granted
10 * provided that this copyright notice appears in all copies. For
11 * precise terms see the accompanying LICENSE file.
13 * This software is provided "AS IS" with no warranty of any kind,
14 * express or implied, and with no claim as to its suitability for any
20 #include<lemon/list_graph.h>
21 #include<lemon/smart_graph.h>
22 #include<lemon/dijkstra.h>
23 #include<lemon/preflow.h>
25 #include"bench_tools.h"
28 using namespace lemon;
30 inline int numOfOnes(int n,int dim)
33 for(int i=0;i<dim;i++) {
40 inline int numOfZeros(int n,int dim)
43 for(int i=0;i<dim;i++) {
50 int main(int argc, char *argv[])
52 // typedef ListGraph Graph;
53 typedef SmartGraph Graph;
55 GRAPH_TYPEDEFS(Graph);
62 cout << "Usage: " << argv[0] << " dim\n";
66 int dim=atoi(argv[1]);
68 // cout << "Creating Hipercube ("<< (1<<dim) << " nodes, "
69 // << dim*(1<<dim) << " edges):";
73 addBiDirHyperCube(G,dim,nodes);
75 PrintTime("GENGRAPH",T);
78 Graph::EdgeMap<int> map(G);
79 for(int i=0;i<5;i++) {
81 for(int i=0;i<dim*(1<<dim);i++) P();
83 // for(EdgeIt e(G);G.valid(e);G.next(e)) map[e]=P();
85 ///\todo It must have been commented out because of
88 // for(int i=0;i<dim*(1<<dim);i++) {
89 // te.setToId(((long long int)(i)*93505)%(dim*(1<<dim)));
90 // // map[Edge(((long long int)(i)*2987)%(dim*(1<<dim)))]=P();
94 // for(int i=0;i<(1<<dim);i++) {
95 // int mul= (1<<(numOfZeros(i,dim)/4));
96 // for(OutEdgeIt e(G,nodes[i]);G.valid(e);G.next(e))
101 PrintTime("GENLENGTHS",T);
105 Dijkstra<Graph> Dij(G,map);
106 for(int i=0;i<10;i++)
109 PrintTime("DIJKSTRA",T);
113 Graph::EdgeMap<int> flow(G);
115 Preflow<Graph,int> MF(G,nodes[0],nodes[1<<dim-1],map,flow);
116 for(int i=0;i<10;i++)
119 PrintTime("PREFLOW",T);