// -*- c++ -*- #include #include #include #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 namespace hugo; int main() { //typedef UndirListGraph Graph; typedef BipartiteGraph Graph; typedef Graph::Node Node; typedef Graph::NodeIt NodeIt; typedef Graph::Edge Edge; typedef Graph::EdgeIt EdgeIt; typedef Graph::OutEdgeIt OutEdgeIt; Graph g; std::vector s_nodes; std::vector t_nodes; int a; std::cout << "number of nodes in the first color class="; std::cin >> a; int b; std::cout << "number of nodes in the second color class="; std::cin >> b; int m; std::cout << "number of edges="; std::cin >> m; std::cout << "Generatig a random bipartite graph..." << std::endl; for (int i=0; i stGW; stGW stgw(g); ConstMap const1map(1); Timer ts; ts.reset(); stGW::EdgeMap flow(stgw); MaxFlow, stGW::EdgeMap > max_flow_test(stgw, stgw.S_NODE, stgw.T_NODE, const1map, flow); max_flow_test.run(); // 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 << "max flow value: " << max_flow_test.flowValue() << std::endl; std::cout << "elapsed time: " << ts << std::endl; // FOR_EACH_LOC(stGW::EdgeIt, e, stgw) { // if (flow[e]) std::cout << e << std::endl; // } // std::cout << std::endl; return 0; }