| 1 | #include <iostream> | 
|---|
| 2 | #include <fstream> | 
|---|
| 3 |  | 
|---|
| 4 | #include <smart_graph.h> | 
|---|
| 5 | #include <list_graph.h> | 
|---|
| 6 | #include <dimacs.h> | 
|---|
| 7 | #include <prim.h> | 
|---|
| 8 | #include <time_measure.h> | 
|---|
| 9 |  | 
|---|
| 10 | #include <bin_heap.h> | 
|---|
| 11 | #include <fib_heap.h> | 
|---|
| 12 |  | 
|---|
| 13 | using namespace lemon; | 
|---|
| 14 |  | 
|---|
| 15 | int main(int, char **) { | 
|---|
| 16 |   typedef SmartGraph::Node Node; | 
|---|
| 17 |  | 
|---|
| 18 |   SmartGraph G; | 
|---|
| 19 |   Node s, t; | 
|---|
| 20 |   SmartGraph::EdgeMap<int> cap(G); | 
|---|
| 21 |   readDimacsMaxFlow(std::cin, G, s, t, cap); | 
|---|
| 22 |  | 
|---|
| 23 |   std::cout << "prim demo ..." << std::endl; | 
|---|
| 24 |    | 
|---|
| 25 |   double pre_time=currTime(); | 
|---|
| 26 |     Prim<SmartGraph, int, FibHeap<SmartGraph::Node, int,  | 
|---|
| 27 |     SmartGraph::NodeMap<int> > > prim_test(G, cap); | 
|---|
| 28 |     prim_test.run(); | 
|---|
| 29 |   double post_time=currTime(); | 
|---|
| 30 |      | 
|---|
| 31 |   std::cout << "running time with fib_heap: "  | 
|---|
| 32 |             << post_time-pre_time << " sec"<< std::endl;  | 
|---|
| 33 |   | 
|---|
| 34 |   pre_time=currTime(); | 
|---|
| 35 |   Prim<SmartGraph, int, BinHeap<SmartGraph::Node, int,  | 
|---|
| 36 |     SmartGraph::NodeMap<int> > > prim_test2(G, cap); | 
|---|
| 37 |   prim_test2.run(); | 
|---|
| 38 |   post_time=currTime(); | 
|---|
| 39 |    | 
|---|
| 40 |   std::cout << "running time with bin_heap: "  | 
|---|
| 41 |             << post_time-pre_time << " sec"<< std::endl;  | 
|---|
| 42 |    | 
|---|
| 43 |   std::cout<<"A minimalis feszitofa sulya fib kupaccal: "<< prim_test.weight() <<std::endl; | 
|---|
| 44 |   std::cout<<"A minimalis feszitofa sulya bin kupaccal: "<< prim_test2.weight() <<std::endl; | 
|---|
| 45 |   if ( prim_test.weight() != prim_test2.weight() )  | 
|---|
| 46 |     std::cout<<"Nem egyezik meg!"<<std::endl;  | 
|---|
| 47 |   else std::cout<<"Megegyezik."<<std::endl;  | 
|---|
| 48 |  | 
|---|
| 49 |   return 0; | 
|---|
| 50 | } | 
|---|