matching.c
资源名称:leda.tar.gz [点击查看]
上传用户:gzelex
上传日期:2007-01-07
资源大小:707k
文件大小:1k
源码类别:
数值算法/人工智能
开发平台:
MultiPlatform
- #include <LEDA/graph_edit.h>
- #include <LEDA/graph_alg.h>
- main()
- {
- GRAPH<point,int> G;
- window W;
- edge e;
- W.set_line_width(1);
- W.set_node_width(12);
- graph_edit(W,G,false);
- for(;;)
- {
- list<edge> L = MAX_CARD_MATCHING(G);
- // show matching
- W.set_line_width(5);
- forall(e,L) W.draw_edge(G[source(e)],G[target(e)]);
- W.message("MAX_CARD_MATCHING");
- W.message("(press left button to return to graph edit)");
- if (W.read_mouse() != 1) break;
- W.del_messages();
- // restore picture
- forall(e,L) W.draw_edge(G[source(e)],G[target(e)],white);
- W.set_line_width(1);
- forall(e,L) W.draw_edge(G[source(e)],G[target(e)]);
- graph_edit(W,G,false,false); // 2nd false: do not clear window
- }
- return 0;
- }