# HG changeset patch # User marci # Date 1093260369 0 # Node ID eb61fbc64c16154488da6f3843f6c748b2a62c85 # Parent a5e9303a551114312b919b6f462fe2dcdb0afbe0 . diff -r a5e9303a5511 -r eb61fbc64c16 src/work/marci/leda/bipartite_matching_leda.cc --- a/src/work/marci/leda/bipartite_matching_leda.cc Mon Aug 23 11:06:00 2004 +0000 +++ b/src/work/marci/leda/bipartite_matching_leda.cc Mon Aug 23 11:26:09 2004 +0000 @@ -14,11 +14,11 @@ //#include //#include #include -#include +#include #include #include #include -#include +#include /** * Inicializalja a veletlenszamgeneratort. @@ -95,7 +95,7 @@ BGW::NodeMap dbyj(bgw); BGW::EdgeMap dbyxcj(bgw); - typedef stGraphWrapper stGW; + typedef stBipartiteGraphWrapper stGW; stGW stgw(bgw); ConstMap const1map(1); @@ -109,9 +109,10 @@ // while (max_flow_test.augmentOnShortestPath()) { } typedef SageGraph MutableGraph; // while (max_flow_test.augmentOnBlockingFlow1()) { - while (max_flow_test.augmentOnBlockingFlow2()) { - std::cout << max_flow_test.flowValue() << std::endl; - } +// while (max_flow_test.augmentOnBlockingFlow2()) { +// std::cout << max_flow_test.flowValue() << std::endl; +// } + max_flow_test.run(); std::cout << "max flow value: " << max_flow_test.flowValue() << std::endl; std::cout << "elapsed time: " << ts << std::endl; diff -r a5e9303a5511 -r eb61fbc64c16 src/work/marci/leda/bipartite_matching_leda_gen.cc --- a/src/work/marci/leda/bipartite_matching_leda_gen.cc Mon Aug 23 11:06:00 2004 +0000 +++ b/src/work/marci/leda/bipartite_matching_leda_gen.cc Mon Aug 23 11:26:09 2004 +0000 @@ -14,11 +14,12 @@ //#include //#include #include -#include +#include #include #include #include -#include +#include +#include /** * Inicializalja a veletlenszamgeneratort. @@ -125,10 +126,12 @@ ts.reset(); FOR_EACH_LOC(stGW::EdgeIt, e, stgw) flow.set(e, 0); typedef SageGraph MutableGraph; - while (max_flow_test.augmentOnBlockingFlow()) { } + AugmentingFlow, stGW::EdgeMap > + max_flow_test_1(stgw, stgw.S_NODE, stgw.T_NODE, const1map, flow/*, true*/); + while (max_flow_test_1.augmentOnBlockingFlow()) { } std::cout << "HUGO max matching algorithm based on blocking flow augmentation." << std::endl << "Matching size: " - << max_flow_test.flowValue() << std::endl; + << max_flow_test_1.flowValue() << std::endl; std::cout << "elapsed time: " << ts << std::endl; return 0; diff -r a5e9303a5511 -r eb61fbc64c16 src/work/marci/leda/comparison.cc --- a/src/work/marci/leda/comparison.cc Mon Aug 23 11:06:00 2004 +0000 +++ b/src/work/marci/leda/comparison.cc Mon Aug 23 11:26:09 2004 +0000 @@ -14,33 +14,14 @@ //#include //#include #include -#include +#include #include #include #include -#include +#include -/** - * Inicializalja a veletlenszamgeneratort. - * Figyelem, ez nem jo igazi random szamokhoz, - * erre ne bizzad a titkaidat! - */ -void random_init() -{ - unsigned int seed = getpid(); - seed |= seed << 15; - seed ^= time(0); - - srand(seed); -} - -/** - * Egy veletlen int-et ad vissza 0 es m-1 kozott. - */ -int random(int m) -{ - return int( double(m) * rand() / (RAND_MAX + 1.0) ); -} +using std::cout; +using std::endl; using namespace hugo; @@ -65,19 +46,19 @@ std::vector t_nodes; int a; - std::cout << "number of nodes in the first color class="; + cout << "number of nodes in the first color class="; std::cin >> a; int b; - std::cout << "number of nodes in the second color class="; + cout << "number of nodes in the second color class="; std::cin >> b; int m; - std::cout << "number of edges="; + cout << "number of edges="; std::cin >> m; int k; - std::cout << "A bipartite graph is a random group graph if the color classes \nA and B are partitiones to A_0, A_1, ..., A_{k-1} and B_0, B_1, ..., B_{k-1} \nas equally as possible \nand the edges from A_i goes to A_{i-1 mod k} and A_{i+1 mod k}.\n"; - std::cout << "number of groups in LEDA random group graph="; + cout << "A bipartite graph is a random group graph if the color classes \nA and B are partitiones to A_0, A_1, ..., A_{k-1} and B_0, B_1, ..., B_{k-1} \nas equally as possible \nand the edges from A_i goes to A_{i-1 mod k} and A_{i+1 mod k}.\n"; + cout << "number of groups in LEDA random group graph="; std::cin >> k; - std::cout << std::endl; + cout << endl; leda_list lS; leda_list lT; @@ -109,26 +90,26 @@ MaxFlow, stGW::EdgeMap > max_flow_test(stgw, stgw.S_NODE, stgw.T_NODE, const1map, flow/*, true*/); max_flow_test.run(); - std::cout << "HUGO max matching algorithm based on preflow." << std::endl + cout << "HUGO max matching algorithm based on preflow." << endl << "Size of matching: " - << max_flow_test.flowValue() << std::endl; - std::cout << "elapsed time: " << ts << std::endl << std::endl; + << max_flow_test.flowValue() << endl; + cout << "elapsed time: " << ts << endl << endl; ts.reset(); leda_list ml=MAX_CARD_BIPARTITE_MATCHING(lg); - std::cout << "LEDA max matching algorithm." << std::endl + cout << "LEDA max matching algorithm." << endl << "Size of matching: " - << ml.size() << std::endl; - std::cout << "elapsed time: " << ts << std::endl << std::endl; + << ml.size() << endl; + cout << "elapsed time: " << ts << endl << endl; // ts.reset(); // FOR_EACH_LOC(stGW::EdgeIt, e, stgw) flow.set(e, 0); // typedef SageGraph MutableGraph; // while (max_flow_test.augmentOnBlockingFlow()) { } -// std::cout << "HUGO max matching algorithm based on blocking flow augmentation." -// << std::endl << "Matching size: " -// << max_flow_test.flowValue() << std::endl; -// std::cout << "elapsed time: " << ts << std::endl << std::endl; +// cout << "HUGO max matching algorithm based on blocking flow augmentation." +// << endl << "Matching size: " +// << max_flow_test.flowValue() << endl; +// cout << "elapsed time: " << ts << endl << endl; { SageGraph hg; @@ -159,11 +140,11 @@ SageGraph::EdgeMap > max_flow_test(hg, s, t, cm, flow); max_flow_test.run(); - std::cout << "HUGO max matching algorithm on SageGraph by copying the graph, based on preflow." - << std::endl + cout << "HUGO max matching algorithm on SageGraph by copying the graph, based on preflow." + << endl << "Size of matching: " - << max_flow_test.flowValue() << std::endl; - std::cout << "elapsed time: " << ts << std::endl << std::endl; + << max_flow_test.flowValue() << endl; + cout << "elapsed time: " << ts << endl << endl; } return 0;