# HG changeset patch # User marci # Date 1083257940 0 # Node ID dce64ce044d6894fcc0193600bd0cbea920e0029 # Parent 54d8feda437bac454fb55eb1e24876b49c92e7d6 corrections for leda matching files diff -r 54d8feda437b -r dce64ce044d6 src/work/marci/leda/bipartite_matching_leda.cc --- a/src/work/marci/leda/bipartite_matching_leda.cc Thu Apr 29 16:45:40 2004 +0000 +++ b/src/work/marci/leda/bipartite_matching_leda.cc Thu Apr 29 16:59:00 2004 +0000 @@ -18,8 +18,7 @@ //#include #include #include -#include -#include +#include /** * Inicializalja a veletlenszamgeneratort. @@ -101,10 +100,12 @@ ConstMap const1map(1); Timer ts; + stGW::EdgeMap flow(stgw); + MaxFlow, stGW::EdgeMap > + max_flow_test(stgw, stgw.S_NODE, stgw.T_NODE, const1map, flow); + ts.reset(); - stGW::EdgeMap max_flow(stgw); - MaxFlow, stGW::EdgeMap > - max_flow_test(stgw, stgw.S_NODE, stgw.T_NODE, const1map, max_flow); + FOR_EACH_LOC(stGW::EdgeIt, e, stgw) flow.set(e, 0); // while (max_flow_test.augmentOnShortestPath()) { } typedef ListGraph MutableGraph; // while (max_flow_test.augmentOnBlockingFlow1()) { @@ -113,35 +114,17 @@ } std::cout << "max flow value: " << max_flow_test.flowValue() << std::endl; std::cout << "elapsed time: " << ts << std::endl; -// FOR_EACH_LOC(stGW::EdgeIt, e, stgw) { -// std::cout << e << ": " << max_flow[e] << "\n"; -// } -// std::cout << "\n"; ts.reset(); - stGW::EdgeMap pre_flow(stgw); - Preflow, stGW::EdgeMap > - pre_flow_test(stgw, stgw.S_NODE, stgw.T_NODE, const1map, pre_flow/*, true*/); - pre_flow_test.run(); + FOR_EACH_LOC(stGW::EdgeIt, e, stgw) flow.set(e, 0); + max_flow_test.run(); std::cout << "pre flow value: " << max_flow_test.flowValue() << std::endl; std::cout << "elapsed time: " << ts << std::endl; -// FOR_EACH_LOC(stGW::EdgeIt, e, stgw) { -// std::cout << e << ": " << pre_flow[e] << "\n"; -// } -// std::cout << "\n"; ts.reset(); leda_list ml=MAX_CARD_BIPARTITE_MATCHING(lg); - // stGW::EdgeMap pre_flow(stgw); - //Preflow, stGW::EdgeMap > - // pre_flow_test(stgw, stgw.S_NODE, stgw.T_NODE, const1map, pre_flow, true); - //pre_flow_test.run(); std::cout << "leda matching value: " << ml.size() << std::endl; std::cout << "elapsed time: " << ts << std::endl; -// FOR_EACH_LOC(stGW::EdgeIt, e, stgw) { -// std::cout << e << ": " << pre_flow[e] << "\n"; -// } -// std::cout << "\n"; return 0; } diff -r 54d8feda437b -r dce64ce044d6 src/work/marci/leda/bipartite_matching_leda_gen.cc --- a/src/work/marci/leda/bipartite_matching_leda_gen.cc Thu Apr 29 16:45:40 2004 +0000 +++ b/src/work/marci/leda/bipartite_matching_leda_gen.cc Thu Apr 29 16:59:00 2004 +0000 @@ -15,11 +15,9 @@ //#include #include #include -//#include #include #include -#include -#include +#include /** * Inicializalja a veletlenszamgeneratort. @@ -78,82 +76,59 @@ 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="; std::cin >> k; - + std::cout << std::endl; + leda_list lS; leda_list lT; random_bigraph(lg, a, b, m, lS, lT, k); -// for (int i=0; i ref_map(g, -1); + IterableBoolMap< Graph::NodeMap > bipartite_map(ref_map); -// random_init(); -// for(int i=0; i ref_map(g, -1); - - IterableBoolMap< Graph::NodeMap > bipartite_map(ref_map); -// for (int i=0; i BGW; BGW bgw(g, bipartite_map); - // BGW::NodeMap dbyj(bgw); - // BGW::EdgeMap dbyxcj(bgw); + //st-wrapper typedef stGraphWrapper stGW; stGW stgw(bgw); ConstMap const1map(1); stGW::EdgeMap flow(stgw); Timer ts; + + ts.reset(); FOR_EACH_LOC(stGW::EdgeIt, e, stgw) flow.set(e, 0); - ts.reset(); - // stGW::EdgeMap pre_flow(stgw); - Preflow, stGW::EdgeMap > - pre_flow_test(stgw, stgw.S_NODE, stgw.T_NODE, const1map, flow/*, true*/); - pre_flow_test.run(); - std::cout << "HUGO pre flow value: " << pre_flow_test.flowValue() << std::endl; - std::cout << "elapsed time: " << ts << std::endl; -// FOR_EACH_LOC(stGW::EdgeIt, e, stgw) { -// std::cout << e << ": " << pre_flow[e] << "\n"; -// } - std::cout << "\n"; + 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 + << "Size of matching: " + << max_flow_test.flowValue() << std::endl; + std::cout << "elapsed time: " << ts << std::endl << std::endl; ts.reset(); leda_list ml=MAX_CARD_BIPARTITE_MATCHING(lg); - // stGW::EdgeMap pre_flow(stgw); - //Preflow, stGW::EdgeMap > - // pre_flow_test(stgw, stgw.S_NODE, stgw.T_NODE, const1map, pre_flow, true); - //pre_flow_test.run(); - std::cout << "LEDA matching value: " << ml.size() << std::endl; + std::cout << "LEDA max matching algorithm." << std::endl + << "Size of matching: " + << ml.size() << std::endl; std::cout << "elapsed time: " << ts << std::endl; -// FOR_EACH_LOC(stGW::EdgeIt, e, stgw) { -// std::cout << e << ": " << pre_flow[e] << "\n"; -// } std::cout << "\n"; + ts.reset(); FOR_EACH_LOC(stGW::EdgeIt, e, stgw) flow.set(e, 0); - ts.reset(); - MaxFlow, stGW::EdgeMap > - max_flow_test(stgw, stgw.S_NODE, stgw.T_NODE, const1map, flow); -// while (max_flow_test.augmentOnShortestPath()) { } typedef ListGraph MutableGraph; -// while (max_flow_test.augmentOnBlockingFlow1()) { - while (max_flow_test.augmentOnBlockingFlow2()) { - std::cout << max_flow_test.flowValue() << std::endl; - } - std::cout << "HUGO blocking flow value: " << max_flow_test.flowValue() << std::endl; + 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; -// FOR_EACH_LOC(stGW::EdgeIt, e, stgw) { -// std::cout << e << ": " << max_flow[e] << "\n"; -// } -// std::cout << "\n"; return 0; } diff -r 54d8feda437b -r dce64ce044d6 src/work/marci/leda/leda_graph_wrapper.h --- a/src/work/marci/leda/leda_graph_wrapper.h Thu Apr 29 16:45:40 2004 +0000 +++ b/src/work/marci/leda/leda_graph_wrapper.h Thu Apr 29 16:59:00 2004 +0000 @@ -46,7 +46,7 @@ protected: Graph* _graph; LedaGraphWrapper() : _graph(0) { } - setGraph(Graph& __graph) { _graph=&__graph; } + void setGraph(Graph& __graph) { _graph=&__graph; } public: //LedaGraphWrapper() { }