jacint@159: #include jacint@160: #include jacint@159: jacint@159: #include jacint@160: #include jacint@159: #include jacint@160: #include jacint@159: jacint@170: #include jacint@170: #include jacint@170: jacint@159: using namespace hugo; jacint@159: jacint@160: int main(int, char **) { jacint@159: typedef ListGraph::NodeIt NodeIt; jacint@170: typedef ListGraph::EachNodeIt EachNodeIt; jacint@170: typedef ListGraph::InEdgeIt InEdgeIt; jacint@160: jacint@160: ListGraph G; jacint@160: NodeIt s, t; jacint@160: ListGraph::EdgeMap cap(G); jacint@160: readDimacsMaxFlow(std::cin, G, s, t, cap); jacint@160: jacint@160: std::cout << "dijkstra demo ..." << std::endl; jacint@159: jacint@160: double pre_time=currTime(); jacint@170: Dijkstra > > dijkstra_test(G, s, cap); jacint@167: dijkstra_test.run(); jacint@160: double post_time=currTime(); jacint@160: jacint@170: std::cout << "running time with fib_heap: " jacint@170: << post_time-pre_time << " sec"<< std::endl; jacint@159: jacint@170: pre_time=currTime(); jacint@170: Dijkstra > > dijkstra_test2(G, s, cap); jacint@170: dijkstra_test2.run(); jacint@170: post_time=currTime(); jacint@170: jacint@170: std::cout << "running time with bin_heap: " jacint@170: << post_time-pre_time << " sec"<< std::endl; jacint@170: jacint@170: jacint@170: int hiba_fib=0; jacint@170: int hiba_bin=0; jacint@170: EachNodeIt u; jacint@170: for ( G.getFirst(u) ; G.valid(u); G.next(u) ) { jacint@170: InEdgeIt e; jacint@170: for ( G.getFirst(e,u); G.valid(e); G.next(e) ) { jacint@170: NodeIt v=G.tail(e); jacint@170: if ( dijkstra_test.dist(u) - dijkstra_test.dist(v) > cap.get(e) ) jacint@170: { jacint@170: std::cout<<"Hibas el a fibonaccis Dijkstraban: " jacint@170: << dijkstra_test.dist(u) - dijkstra_test.dist(v) - jacint@170: cap.get(e)< cap.get(e) ) jacint@170: { jacint@170: std::cout<<"Hibas el a binarisos Dijkstraban: " jacint@170: << dijkstra_test2.dist(u) - dijkstra_test2.dist(v) - jacint@170: cap.get(e)<