1 #include <cstdlib> |
1 #include <cstdlib> |
2 #include <iostream> |
2 #include <iostream> |
3 #include <sstream> |
3 #include <sstream> |
4 |
4 |
5 #include <lemon/smart_graph.h> |
5 #include <lemon/smart_graph.h> |
|
6 #include <lemon/list_graph.h> |
6 |
7 |
7 #include <lemon/bpugraph_adaptor.h> |
8 #include <lemon/bpugraph_adaptor.h> |
8 #include <lemon/bipartite_matching.h> |
9 #include <lemon/bipartite_matching.h> |
9 |
10 |
10 #include <lemon/graph_utils.h> |
11 #include <lemon/graph_utils.h> |
38 int m = (100 - k) * 100; |
40 int m = (100 - k) * 100; |
39 int e = 20000; |
41 int e = 20000; |
40 int s = 100; |
42 int s = 100; |
41 |
43 |
42 Timer nt(false), st(false); |
44 Timer nt(false), st(false); |
|
45 Timer lnt(false), lst(false); |
43 |
46 |
44 for (int i = 0; i < s; ++i) { |
47 for (int i = 0; i < s; ++i) { |
45 Graph graph; |
48 Graph graph; |
|
49 LGraph lgraph; |
46 vector<Node> aNodes; |
50 vector<Node> aNodes; |
47 vector<Node> bNodes; |
51 vector<Node> bNodes; |
|
52 vector<LGraph::Node> laNodes; |
|
53 vector<LGraph::Node> lbNodes; |
48 |
54 |
49 for (int i = 0; i < n; ++i) { |
55 for (int i = 0; i < n; ++i) { |
50 Node node = graph.addANode(); |
56 Node node = graph.addANode(); |
51 aNodes.push_back(node); |
57 aNodes.push_back(node); |
|
58 LGraph::Node lnode = lgraph.addANode(); |
|
59 laNodes.push_back(lnode); |
52 } |
60 } |
53 for (int i = 0; i < m; ++i) { |
61 for (int i = 0; i < m; ++i) { |
54 Node node = graph.addBNode(); |
62 Node node = graph.addBNode(); |
55 bNodes.push_back(node); |
63 bNodes.push_back(node); |
|
64 LGraph::Node lnode = lgraph.addBNode(); |
|
65 lbNodes.push_back(lnode); |
56 } |
66 } |
57 for (int i = 0; i < e; ++i) { |
67 for (int i = 0; i < e; ++i) { |
58 Node aNode = aNodes[urandom(n)]; |
68 int a,b; |
59 Node bNode = bNodes[urandom(m)]; |
69 Node aNode = aNodes[a=urandom(n)]; |
|
70 Node bNode = bNodes[b=urandom(m)]; |
60 graph.addEdge(aNode, bNode); |
71 graph.addEdge(aNode, bNode); |
|
72 LGraph::Node laNode = laNodes[a]; |
|
73 LGraph::Node lbNode = lbNodes[b]; |
|
74 lgraph.addEdge(laNode, lbNode); |
61 } |
75 } |
62 |
76 |
63 { |
77 { |
64 MaxBipartiteMatching<Graph> bpmatch(graph); |
78 MaxBipartiteMatching<Graph> bpmatch(graph); |
65 |
79 |