.
4 #include <list_graph.hh>
7 #include <time_measure.h>
14 int main(int, char **) {
15 typedef ListGraph::NodeIt NodeIt;
16 typedef ListGraph::EachNodeIt EachNodeIt;
17 typedef ListGraph::InEdgeIt InEdgeIt;
21 ListGraph::EdgeMap<int> cap(G);
22 readDimacsMaxFlow(std::cin, G, s, t, cap);
24 std::cout << "dijkstra demo ..." << std::endl;
26 double pre_time=currTime();
27 Dijkstra<ListGraph, int, FibHeap<ListGraph::NodeIt, int,
28 ListGraph::NodeMap<int> > > dijkstra_test(G, s, cap);
30 double post_time=currTime();
32 std::cout << "running time with fib_heap: "
33 << post_time-pre_time << " sec"<< std::endl;
36 Dijkstra<ListGraph, int, BinHeap<ListGraph::NodeIt, int,
37 ListGraph::NodeMap<int> > > dijkstra_test2(G, s, cap);
41 std::cout << "running time with bin_heap: "
42 << post_time-pre_time << " sec"<< std::endl;
48 for ( G.getFirst(u) ; G.valid(u); G.next(u) ) {
50 for ( G.getFirst(e,u); G.valid(e); G.next(e) ) {
52 if ( dijkstra_test.dist(u) - dijkstra_test.dist(v) > cap.get(e) )
54 std::cout<<"Hibas el a fibonaccis Dijkstraban: "
55 << dijkstra_test.dist(u) - dijkstra_test.dist(v) -
56 cap.get(e)<<std::endl;
59 if ( dijkstra_test2.dist(u) - dijkstra_test2.dist(v) > cap.get(e) )
61 std::cout<<"Hibas el a binarisos Dijkstraban: "
62 << dijkstra_test2.dist(u) - dijkstra_test2.dist(v) -
63 cap.get(e)<<std::endl;
66 if ( e==dijkstra_test.pred(u) &&
67 dijkstra_test.dist(u) - dijkstra_test.dist(v) != cap.get(e) )
69 std::cout<<"Hibas fael a fibonaccis Dijkstraban: "<<
70 dijkstra_test.dist(u) - dijkstra_test.dist(v)- cap.get(e)<<std::endl;
73 if ( e==dijkstra_test2.pred(u) &&
74 dijkstra_test2.dist(u) - dijkstra_test2.dist(v) != cap.get(e) )
76 std::cout<<"Hibas fael a binarisos Dijkstraban: "<<
77 dijkstra_test2.dist(u) - dijkstra_test2.dist(v)- cap.get(e)<<std::endl;
82 if ( dijkstra_test.dist(u) != dijkstra_test2.dist(u) )
83 std::cout << "Nem egyezik meg a tavolsag!"<<std::endl;
88 std::cout << "Hibas elek szama a fibonaccis Dijkstraban: "
89 << hiba_fib << " a " << G.edgeNum() <<"-bol."<< std::endl;
91 std::cout << "Hibas elek szama a binarisos Dijkstraban: "
92 << hiba_bin << " a " << G.edgeNum() <<"-bol."<< std::endl;