4 #include <smart_graph.h>
5 #include <list_graph.h>
8 #include <time_measure.h>
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);
23 readDimacsMaxFlow(std::cin, G, s, t, cap);
25 std::cout << "dijkstra demo ..." << std::endl;
27 double pre_time=currTime();
28 Dijkstra<SmartGraph, int, FibHeap<SmartGraph::Node, int,
29 SmartGraph::NodeMap<int> > > dijkstra_test(G, cap);
31 double post_time=currTime();
33 std::cout << "running time with fib_heap: "
34 << post_time-pre_time << " sec"<< std::endl;
37 Dijkstra<SmartGraph, int, BinHeap<SmartGraph::Node, int,
38 SmartGraph::NodeMap<int> > > dijkstra_test2(G, cap);
39 dijkstra_test2.run(s);
42 std::cout << "running time with bin_heap: "
43 << post_time-pre_time << " sec"<< std::endl;
49 for ( G.first(u) ; G.valid(u); G.next(u) ) {
51 for ( G.first(e,u); G.valid(e); G.next(e) ) {
53 if ( dijkstra_test.dist(u) - dijkstra_test.dist(v) > cap[e] )
55 std::cout<<"Hibas el a fibonaccis Dijkstraban: "
56 << dijkstra_test.dist(u) - dijkstra_test.dist(v) -
60 if ( dijkstra_test2.dist(u) - dijkstra_test2.dist(v) > cap[e] )
62 std::cout<<"Hibas el a binarisos Dijkstraban: "
63 << dijkstra_test2.dist(u) - dijkstra_test2.dist(v) -
67 if ( e==dijkstra_test.pred(u) &&
68 dijkstra_test.dist(u) - dijkstra_test.dist(v) != cap[e] )
70 std::cout<<"Hibas fael a fibonaccis Dijkstraban: "<<
71 dijkstra_test.dist(u) - dijkstra_test.dist(v)- cap[e]<<std::endl;
74 if ( e==dijkstra_test2.pred(u) &&
75 dijkstra_test2.dist(u) - dijkstra_test2.dist(v) != cap[e] )
77 std::cout<<"Hibas fael a binarisos Dijkstraban: "<<
78 dijkstra_test2.dist(u) - dijkstra_test2.dist(v)- cap[e]<<std::endl;
83 if ( dijkstra_test.dist(u) != dijkstra_test2.dist(u) )
84 std::cout << "Nem egyezik meg a tavolsag!"<<std::endl;
89 std::cout << "Hibas elek szama a fibonaccis Dijkstraban: "
90 << hiba_fib << " a " << G.edgeNum() <<"-bol."<< std::endl;
92 std::cout << "Hibas elek szama a binarisos Dijkstraban: "
93 << hiba_bin << " a " << G.edgeNum() <<"-bol."<< std::endl;