4 #include <smart_graph.h>
5 #include <list_graph.h>
8 #include <time_measure.h>
10 #include <bin_heap.hh>
15 int main(int, char **) {
16 typedef SmartGraph::Node Node;
17 typedef SmartGraph::NodeIt NodeIt;
18 typedef SmartGraph::InEdgeIt InEdgeIt;
22 SmartGraph::EdgeMap<int> cap(G);
24 std::cout << "DIMACS load ..." << std::endl;
25 readDimacsMaxFlow(std::cin, G, s, t, cap);
26 std::cout << " " << tim <<std::endl;
28 std::cout << "dijkstra demo ..." << std::endl;
30 //double pre_time=currTime();
33 SmartGraph::EdgeMap<int>,
34 FibHeap<SmartGraph::Node, int, SmartGraph::NodeMap<int> >
35 > dijkstra_test(G, cap);
38 //double post_time=currTime();
40 std::cout << "running time with fib_heap: "
41 // << post_time-pre_time << " sec"
45 //pre_time=currTime();
47 Dijkstra < SmartGraph,
48 SmartGraph::EdgeMap<int>,
49 BinHeap<SmartGraph::Node, int, SmartGraph::NodeMap<int> > >
50 dijkstra_test2(G, cap);
52 dijkstra_test2.run(s);
53 //post_time=currTime();
55 std::cout << "running time with bin_heap: "
56 // << post_time-pre_time << " sec"
64 for ( G.first(u) ; G.valid(u); G.next(u) ) {
66 for ( G.first(e,u); G.valid(e); G.next(e) ) {
68 if ( dijkstra_test.dist(u) - dijkstra_test.dist(v) > cap[e] )
70 std::cout<<"Hibas el a fibonaccis Dijkstraban: "
71 << dijkstra_test.dist(u) - dijkstra_test.dist(v) -
75 if ( dijkstra_test2.dist(u) - dijkstra_test2.dist(v) > cap[e] )
77 std::cout<<"Hibas el a binarisos Dijkstraban: "
78 << dijkstra_test2.dist(u) - dijkstra_test2.dist(v) -
82 if ( e==dijkstra_test.pred(u) &&
83 dijkstra_test.dist(u) - dijkstra_test.dist(v) != cap[e] )
85 std::cout<<"Hibas fael a fibonaccis Dijkstraban: "<<
86 dijkstra_test.dist(u) - dijkstra_test.dist(v)- cap[e]<<std::endl;
89 if ( e==dijkstra_test2.pred(u) &&
90 dijkstra_test2.dist(u) - dijkstra_test2.dist(v) != cap[e] )
92 std::cout<<"Hibas fael a binarisos Dijkstraban: "<<
93 dijkstra_test2.dist(u) - dijkstra_test2.dist(v)- cap[e]<<std::endl;
98 if ( dijkstra_test.dist(u) != dijkstra_test2.dist(u) )
99 std::cout << "Nem egyezik meg a tavolsag!"<<std::endl;
104 std::cout << "Hibas elek szama a fibonaccis Dijkstraban: "
105 << hiba_fib << " a " << G.edgeNum() <<"-bol."<< std::endl;
107 std::cout << "Hibas elek szama a binarisos Dijkstraban: "
108 << hiba_bin << " a " << G.edgeNum() <<"-bol."<< std::endl;