Changeset 211:9222a9b8b323 in lemon0.x for src/work/jacint/dijkstra.cc
 Timestamp:
 03/19/04 23:16:05 (20 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@306
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

src/work/jacint/dijkstra.cc
r173 r211 2 2 #include <fstream> 3 3 4 #include <list_graph.hh> 5 #include <dimacs.hh> 4 #include <smart_graph.h> 5 #include <list_graph.h> 6 #include <dimacs.h> 6 7 #include <dijkstra.h> 7 8 #include <time_measure.h> … … 13 14 14 15 int main(int, char **) { 15 typedef ListGraph::NodeIt NodeIt;16 typedef ListGraph::EachNodeIt EachNodeIt;17 typedef ListGraph::InEdgeIt InEdgeIt;16 typedef SmartGraph::Node Node; 17 typedef SmartGraph::NodeIt NodeIt; 18 typedef SmartGraph::InEdgeIt InEdgeIt; 18 19 19 ListGraph G;20 Node Its, t;21 ListGraph::EdgeMap<int> cap(G);20 SmartGraph G; 21 Node s, t; 22 SmartGraph::EdgeMap<int> cap(G); 22 23 readDimacsMaxFlow(std::cin, G, s, t, cap); 23 24 … … 25 26 26 27 double pre_time=currTime(); 27 Dijkstra< ListGraph, int, FibHeap<ListGraph::NodeIt, int,28 ListGraph::NodeMap<int> > > dijkstra_test(G, s, cap);29 dijkstra_test.run( );28 Dijkstra<SmartGraph, int, FibHeap<SmartGraph::Node, int, 29 SmartGraph::NodeMap<int> > > dijkstra_test(G, cap); 30 dijkstra_test.run(s); 30 31 double post_time=currTime(); 31 32 … … 34 35 35 36 pre_time=currTime(); 36 Dijkstra< ListGraph, int, BinHeap<ListGraph::NodeIt, int,37 ListGraph::NodeMap<int> > > dijkstra_test2(G, s, cap);38 dijkstra_test2.run( );37 Dijkstra<SmartGraph, int, BinHeap<SmartGraph::Node, int, 38 SmartGraph::NodeMap<int> > > dijkstra_test2(G, cap); 39 dijkstra_test2.run(s); 39 40 post_time=currTime(); 40 41 … … 45 46 int hiba_fib=0; 46 47 int hiba_bin=0; 47 EachNodeIt u;48 for ( G. getFirst(u) ; G.valid(u); G.next(u) ) {48 NodeIt u; 49 for ( G.first(u) ; G.valid(u); G.next(u) ) { 49 50 InEdgeIt e; 50 for ( G. getFirst(e,u); G.valid(e); G.next(e) ) {51 Node Itv=G.tail(e);51 for ( G.first(e,u); G.valid(e); G.next(e) ) { 52 Node v=G.tail(e); 52 53 if ( dijkstra_test.dist(u)  dijkstra_test.dist(v) > cap.get(e) ) 53 54 { … … 88 89 std::cout << "Hibas elek szama a fibonaccis Dijkstraban: " 89 90 << hiba_fib << " a " << G.edgeNum() <<"bol."<< std::endl; 90 91 91 92 std::cout << "Hibas elek szama a binarisos Dijkstraban: " 92 93 << hiba_bin << " a " << G.edgeNum() <<"bol."<< std::endl; 93 94 94 95 95 96
Note: See TracChangeset
for help on using the changeset viewer.