matching.c
Upload User: gzelex
Upload Date: 2007-01-07
Package Size: 707k
Code Size: 1k
Development Platform:

MultiPlatform

  1. #include <LEDA/graph_alg.h>
  2. #include <LEDA/ugraph.h>
  3. main(int argc, char** argv)
  4. {
  5.   graph G;
  6.   cmdline_graph(G,argc,argv);
  7.   float T = used_time();
  8.   cout << "MAX_CARD_MATCHING (heur=1)           ";
  9.   cout.flush();
  10.   list<edge> M = MAX_CARD_MATCHING(G,1);
  11.   cout << string("time %.2f sec    |M| = %dn",used_time(T), M.length());
  12.   cout << "MAX_CARD_MATCHING (heur=2)           ";
  13.   cout.flush();
  14.   M = MAX_CARD_MATCHING(G,2);
  15.   cout << string("time %.2f sec    |M| = %dn",used_time(T), M.length());
  16.   ugraph U = G;
  17.   edge_array<int> cost(U);
  18.   edge e;
  19.   forall_edges(e,U) cost[e] = rand_int(0,1000);
  20.   cout << "MAX_WEIGHT_MATCHING                  ";
  21.   cout.flush();
  22.   M = MAX_WEIGHT_MATCHING(U,cost);
  23.   cout << string("time %.2f sec    |M| = %dn",used_time(T), M.length());
  24.   
  25.   return 0;
  26. }