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);
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();
32 // Dijkstra <SmartGraph,
33 // SmartGraph::EdgeMap<int>,
34 // FibHeap<SmartGraph::Node, int, SmartGraph::NodeMap<int> >
35 // > dijkstra_test(G, cap);
37 Dijkstra <SmartGraph, SmartGraph::EdgeMap<int>, FibHeap >
38 dijkstra_test(G, cap);
41 //double post_time=currTime();
43 std::cout << "running time with fib_heap: "
44 // << post_time-pre_time << " sec"
48 //pre_time=currTime();
50 // Dijkstra < SmartGraph,
51 // SmartGraph::EdgeMap<int>,
52 // BinHeap<SmartGraph::Node, int, SmartGraph::NodeMap<int> > >
53 // dijkstra_test2(G, cap);
55 Dijkstra <SmartGraph, SmartGraph::EdgeMap<int>, BinHeap >
56 dijkstra_test2(G, cap);
58 dijkstra_test2.run(s);
59 //post_time=currTime();
61 std::cout << "running time with bin_heap: "
62 // << post_time-pre_time << " sec"
70 for ( G.first(u) ; G.valid(u); G.next(u) ) {
72 for ( G.first(e,u); G.valid(e); G.next(e) ) {
74 if ( dijkstra_test.dist(u) - dijkstra_test.dist(v) > cap[e] )
76 std::cout<<"Hibas el a fibonaccis Dijkstraban: "
77 << dijkstra_test.dist(u) - dijkstra_test.dist(v) -
81 if ( dijkstra_test2.dist(u) - dijkstra_test2.dist(v) > cap[e] )
83 std::cout<<"Hibas el a binarisos Dijkstraban: "
84 << dijkstra_test2.dist(u) - dijkstra_test2.dist(v) -
88 if ( e==dijkstra_test.pred(u) &&
89 dijkstra_test.dist(u) - dijkstra_test.dist(v) != cap[e] )
91 std::cout<<"Hibas fael a fibonaccis Dijkstraban: "<<
92 dijkstra_test.dist(u) - dijkstra_test.dist(v)- cap[e]<<std::endl;
95 if ( e==dijkstra_test2.pred(u) &&
96 dijkstra_test2.dist(u) - dijkstra_test2.dist(v) != cap[e] )
98 std::cout<<"Hibas fael a binarisos Dijkstraban: "<<
99 dijkstra_test2.dist(u) - dijkstra_test2.dist(v)- cap[e]<<std::endl;
104 if ( dijkstra_test.dist(u) != dijkstra_test2.dist(u) )
105 std::cout << "Nem egyezik meg a tavolsag!"<<std::endl;
110 std::cout << "Hibas elek szama a fibonaccis Dijkstraban: "
111 << hiba_fib << " a " << G.edgeNum() <<"-bol."<< std::endl;
113 std::cout << "Hibas elek szama a binarisos Dijkstraban: "
114 << hiba_bin << " a " << G.edgeNum() <<"-bol."<< std::endl;