1.1 --- a/src/work/marci/bipartite_matching_try_3.cc Thu May 06 17:01:31 2004 +0000
1.2 +++ b/src/work/marci/bipartite_matching_try_3.cc Thu May 06 17:22:11 2004 +0000
1.3 @@ -2,7 +2,6 @@
1.4 #include <iostream>
1.5 #include <fstream>
1.6 #include <vector>
1.7 -#include <cstdlib>
1.8
1.9 #include <list_graph.h>
1.10 //#include <smart_graph.h>
1.11 @@ -13,6 +12,7 @@
1.12 #include <bipartite_graph_wrapper.h>
1.13 #include <hugo/maps.h>
1.14 #include <max_flow.h>
1.15 +#include <graph_gen.h>
1.16
1.17 using namespace hugo;
1.18
1.19 @@ -79,27 +79,6 @@
1.20 int matchingValue() { return mf.flowValue(); }
1.21 };
1.22
1.23 -/**
1.24 - * Inicializalja a veletlenszamgeneratort.
1.25 - * Figyelem, ez nem jo igazi random szamokhoz,
1.26 - * erre ne bizzad a titkaidat!
1.27 - */
1.28 -void random_init()
1.29 -{
1.30 - unsigned int seed = getpid();
1.31 - seed |= seed << 15;
1.32 - seed ^= time(0);
1.33 -
1.34 - srand(seed);
1.35 -}
1.36 -
1.37 -/**
1.38 - * Egy veletlen int-et ad vissza 0 es m-1 kozott.
1.39 - */
1.40 -int random(int m)
1.41 -{
1.42 - return int( double(m) * rand() / (RAND_MAX + 1.0) );
1.43 -}
1.44
1.45 int main() {
1.46 //typedef UndirListGraph Graph;
1.47 @@ -113,9 +92,6 @@
1.48
1.49 Graph g;
1.50
1.51 - std::vector<Graph::Node> s_nodes;
1.52 - std::vector<Graph::Node> t_nodes;
1.53 -
1.54 int a;
1.55 std::cout << "number of nodes in the first color class=";
1.56 std::cin >> a;
1.57 @@ -127,13 +103,8 @@
1.58 std::cin >> m;
1.59
1.60 std::cout << "Generatig a random bipartite graph..." << std::endl;
1.61 - for (int i=0; i<a; ++i) s_nodes.push_back(g.addNode(false));
1.62 - for (int i=0; i<b; ++i) t_nodes.push_back(g.addNode(true));
1.63 -
1.64 random_init();
1.65 - for(int i=0; i<m; ++i) {
1.66 - g.addEdge(s_nodes[random(a)], t_nodes[random(b)]);
1.67 - }
1.68 + randomBipartiteGraph(g, a, b, m);
1.69
1.70 // std::cout << "Edges of the bipartite graph:" << std::endl;
1.71 // FOR_EACH_LOC(EdgeIt, e, g) std::cout << e << " ";