equal
deleted
inserted
replaced
10 |
10 |
11 #include <lemon/graph_utils.h> |
11 #include <lemon/graph_utils.h> |
12 #include <lemon/graph_to_eps.h> |
12 #include <lemon/graph_to_eps.h> |
13 |
13 |
14 #include <lemon/time_measure.h> |
14 #include <lemon/time_measure.h> |
|
15 #include <lemon/random.h> |
15 |
16 |
16 using namespace std; |
17 using namespace std; |
17 using namespace lemon; |
18 using namespace lemon; |
18 |
19 |
19 typedef SmartBpUGraph Graph; |
20 typedef SmartBpUGraph Graph; |
20 typedef ListBpUGraph LGraph; |
21 typedef ListBpUGraph LGraph; |
21 BPUGRAPH_TYPEDEFS(Graph); |
22 BPUGRAPH_TYPEDEFS(Graph); |
22 |
23 |
23 int _urandom_init() { |
|
24 int seed = time(0); |
|
25 srand(seed); |
|
26 return seed; |
|
27 } |
|
28 |
|
29 int urandom(int n) { |
|
30 static int seed = _urandom_init(); |
|
31 ignore_unused_variable_warning(seed); |
|
32 return (int)(rand() / (1.0 + RAND_MAX) * n); |
|
33 } |
|
34 |
24 |
35 int main() { |
25 int main() { |
36 |
26 |
37 for (int k = 1; k < 100; ++k) { |
27 for (int k = 1; k < 100; ++k) { |
38 |
28 |
64 LGraph::Node lnode = lgraph.addBNode(); |
54 LGraph::Node lnode = lgraph.addBNode(); |
65 lbNodes.push_back(lnode); |
55 lbNodes.push_back(lnode); |
66 } |
56 } |
67 for (int i = 0; i < e; ++i) { |
57 for (int i = 0; i < e; ++i) { |
68 int a,b; |
58 int a,b; |
69 Node aNode = aNodes[a=urandom(n)]; |
59 Node aNode = aNodes[a=rnd[n]]; |
70 Node bNode = bNodes[b=urandom(m)]; |
60 Node bNode = bNodes[b=rnd[m]]; |
71 graph.addEdge(aNode, bNode); |
61 graph.addEdge(aNode, bNode); |
72 LGraph::Node laNode = laNodes[a]; |
62 LGraph::Node laNode = laNodes[a]; |
73 LGraph::Node lbNode = lbNodes[b]; |
63 LGraph::Node lbNode = lbNodes[b]; |
74 lgraph.addEdge(laNode, lbNode); |
64 lgraph.addEdge(laNode, lbNode); |
75 } |
65 } |