equal
deleted
inserted
replaced
19 |
19 |
20 std::cout << "dijkstra demo ..." << std::endl; |
20 std::cout << "dijkstra demo ..." << std::endl; |
21 |
21 |
22 double pre_time=currTime(); |
22 double pre_time=currTime(); |
23 Dijkstra<ListGraph, int> dijkstra_test(G, s, cap); |
23 Dijkstra<ListGraph, int> dijkstra_test(G, s, cap); |
|
24 dijkstra_test.run(); |
24 double post_time=currTime(); |
25 double post_time=currTime(); |
25 |
26 |
26 std::cout << "running time: " << post_time-pre_time << " sec"<< std::endl; |
27 std::cout << "running time: " << post_time-pre_time << " sec"<< std::endl; |
27 |
28 |
|
29 int hiba=0; |
28 EachEdgeIt e; |
30 EachEdgeIt e; |
29 |
|
30 for ( G.getFirst(e) ; G.valid(e); G.next(e) ) { |
31 for ( G.getFirst(e) ; G.valid(e); G.next(e) ) { |
31 NodeIt u=G.tail(e); |
32 NodeIt u=G.tail(e); |
32 NodeIt v=G.head(e); |
33 NodeIt v=G.head(e); |
33 assert ( dijkstra_test.dist(v) - dijkstra_test.dist(u) <= cap.get(e) ); |
34 if ( dijkstra_test.dist(v) - dijkstra_test.dist(u) > cap.get(e) ) { |
|
35 std::cout<<"Hiba: "<<dijkstra_test.dist(v) - dijkstra_test.dist(u) - cap.get(e)<<std::endl; |
|
36 ++hiba; |
|
37 } |
34 } |
38 } |
|
39 |
|
40 std::cout << "Hibas elek szama: " << hiba << " a " << G.edgeNum() <<"-bol."<< std::endl; |
35 |
41 |
36 return 0; |
42 return 0; |
37 } |
43 } |