Check StaticGraphSkeleton, as well.
7 #include <LEDA/graph.h>
8 #include <LEDA/mc_matching.h>
10 #include <LEDA/graph_gen.h>
12 #include <leda_graph_wrapper.h>
13 #include <list_graph.h>
15 #include <time_measure.h>
16 #include <for_each_macros.h>
17 #include <graph_wrapper.h>
18 #include <bipartite_graph_wrapper.h>
20 #include <max_matching.h>
23 // * Inicializalja a veletlenszamgeneratort.
24 // * Figyelem, ez nem jo igazi random szamokhoz,
25 // * erre ne bizzad a titkaidat!
29 // unsigned int seed = getpid();
30 // seed |= seed << 15;
37 // * Egy veletlen int-et ad vissza 0 es m-1 kozott.
41 // return int( double(m) * rand() / (RAND_MAX + 1.0) );
50 //lg.make_undirected();
51 typedef LedaGraphWrapper<leda::graph> Graph;
55 //typedef UndirListGraph Graph;
58 typedef Graph::Node Node;
59 typedef Graph::NodeIt NodeIt;
60 typedef Graph::Edge Edge;
61 typedef Graph::EdgeIt EdgeIt;
62 typedef Graph::OutEdgeIt OutEdgeIt;
64 std::vector<Graph::Node> s_nodes;
65 std::vector<Graph::Node> t_nodes;
68 std::cout << "Number of nodes=";
71 std::cout << "number of edges=";
73 std::cout << std::endl;
75 random_graph(lg, n, m);
79 // writeDimacs(std::cout, g); //for check
81 MaxMatching<Graph> max_matching(g);
83 "Running the edmonds algorithm run()... "
87 std::cout<<"Elapsed time: "<<ts<<std::endl;
89 Graph::NodeMap<Node> mate(g,INVALID);
90 max_matching.writeNMapNode(mate);
92 for(g.first(v); g.valid(v); g.next(v) ) {
93 if ( g.valid(mate[v]) ) {
97 int size=(int)s/2; //size will be used as the size of a maxmatching
98 std::cout << size << " is the size of the matching found by run(),"<<std::endl;
99 if ( size == max_matching.size() ) {
100 std::cout<< "which equals to the size of the actual matching reported by size().\n"<< std::endl;
102 std::cout<< "which does not equal to the size of the actual matching reported by size()!\n"<< std::endl;
109 leda_list<leda_edge> ml=MAX_CARD_MATCHING(lg);
110 std::cout << "LEDA max matching algorithm." << std::endl
111 << "Size of matching: "
112 << ml.size() << std::endl;
113 std::cout << "elapsed time: " << ts << std::endl;