home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / diverses / leda / prog / graphics / matching.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-11-15  |  775 b   |  40 lines

  1. #include <LEDA/window.h>
  2. #include <LEDA/graph_alg.h>
  3. #include <LEDA/graph_edit.h>
  4.  
  5.  
  6. main()
  7.   GRAPH(point,int) G;
  8.   edge e;
  9.  
  10.   window W;
  11.  
  12.   W.set_line_width(1);
  13.  
  14.   W.set_node_width(13);
  15.  
  16.  
  17.   graph_edit(W,G,false);
  18.  
  19.   for(;;)
  20.   { 
  21.     list(edge) L = MAX_CARD_MATCHING(G,true);  // true: report blossoms on cout
  22.  
  23.     W.set_line_width(5);
  24.     forall(e,L) W.draw_edge(G[source(e)],G[target(e)]);       // show matching
  25.  
  26.     W.message("Press left button to continue.");
  27.     if (W.read_mouse() != 1) break;
  28.     W.del_message();
  29.  
  30.     forall(e,L) W.draw_edge(G[source(e)],G[target(e)],white); // restore picture
  31.     W.set_line_width(1);
  32.     forall(e,L) W.draw_edge(G[source(e)],G[target(e)]);
  33.  
  34.     graph_edit(W,G,false,false);       // 2nd false: do not initialize window
  35.  
  36.    }
  37.  
  38. }
  39.