[173] | 1 | #include <iostream> |
---|
| 2 | #include <fstream> |
---|
| 3 | |
---|
[220] | 4 | #include <smart_graph.h> |
---|
[211] | 5 | #include <list_graph.h> |
---|
| 6 | #include <dimacs.h> |
---|
[173] | 7 | #include <prim.h> |
---|
| 8 | #include <time_measure.h> |
---|
| 9 | |
---|
[258] | 10 | #include <bin_heap.h> |
---|
[173] | 11 | #include <fib_heap.h> |
---|
| 12 | |
---|
| 13 | using namespace hugo; |
---|
| 14 | |
---|
| 15 | int main(int, char **) { |
---|
[220] | 16 | typedef SmartGraph::Node Node; |
---|
[173] | 17 | |
---|
[220] | 18 | SmartGraph G; |
---|
[211] | 19 | Node s, t; |
---|
[220] | 20 | SmartGraph::EdgeMap<int> cap(G); |
---|
[173] | 21 | readDimacsMaxFlow(std::cin, G, s, t, cap); |
---|
| 22 | |
---|
| 23 | std::cout << "prim demo ..." << std::endl; |
---|
| 24 | |
---|
| 25 | double pre_time=currTime(); |
---|
[220] | 26 | Prim<SmartGraph, int, FibHeap<SmartGraph::Node, int, |
---|
| 27 | SmartGraph::NodeMap<int> > > prim_test(G, cap); |
---|
[173] | 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(); |
---|
[220] | 35 | Prim<SmartGraph, int, BinHeap<SmartGraph::Node, int, |
---|
| 36 | SmartGraph::NodeMap<int> > > prim_test2(G, cap); |
---|
[173] | 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 | } |
---|