home *** CD-ROM | disk | FTP | other *** search
- #include <LEDA/graph.h>
- #include <LEDA/graph_alg.h>
-
-
- declare2(GRAPH,int,int);
-
- main()
- {
-
- GRAPH(int,int) G;
-
- test_graph(G);
-
- edge_array(int) cap(G,0);
- edge_array(int) flow(G,0);
-
- edge_array(real) cap1(G,0);
- edge_array(real) flow1(G,0);
-
- int a = read_int("a = ");
- int b = read_int("b = ");
-
- edge e;
-
- init_random();
- forall_edges(e,G) cap1[e] = G[e] = cap[e] = random(a,b);
-
- node s = G.first_node();
- node t = G.last_node();
-
- float T = used_time();
-
- cout << "MAX_FLOW (int) ";
- cout.flush();
- int val = MAX_FLOW(G,s,t,cap,flow) ;
- cout << form("flow = %d time: %6.2f sec \n",val,used_time(T));
- newline;
-
- cout << "MAX_FLOW (reals) ";
- cout.flush();
- real val1 = MAX_FLOW(G,s,t,cap1,flow1);
- cout << form("flow = %f time: %6.2f sec \n",~val1,used_time(T));
- newline;
-
- if (Yes("show flow values? "))
- forall_edges(e,G)
- { G.print_edge(e);
- cout << form(" flow = %6d flow1 = %4.2f\n",flow[e],~flow1[e]);
- }
- newline;
-
- }
-
-
-