Changeset 279:be43902fadb7 in lemon0.x
 Timestamp:
 04/03/04 16:22:33 (16 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@393
 Location:
 src/work
 Files:

 5 edited
Legend:
 Unmodified
 Added
 Removed

src/work/bfs_iterator.h
r260 r279 797 797 actual_node=s; 798 798 reached.set(s, true); 799 dfs_stack.push(G.template first<OutEdgeIt>(s)); 799 OutEdgeIt e; 800 G.first(e, s); 801 dfs_stack.push(e); 800 802 } 801 803 DfsIterator5<GraphWrapper, /*OutEdgeIt,*/ ReachedMap>& … … 807 809 actual_node=w; 808 810 if (!reached.get(w)) { 809 dfs_stack.push(G.template first<OutEdgeIt>(w)); 811 OutEdgeIt e; 812 G.first(e, w); 813 dfs_stack.push(e); 810 814 reached.set(w, true); 811 815 b_node_newly_reached=true; 
src/work/edmonds_karp.h
r269 r279 353 353 FilterResGW filter_res_graph(res_graph, dist); 354 354 typename ResGW::NodeMap<typename MG::Node> res_graph_to_F(res_graph); 355 for(typename ResGW::NodeIt n=res_graph.template first<typename ResGW::NodeIt>(); res_graph.valid(n); res_graph.next(n)) { 356 res_graph_to_F.set(n, F.addNode()); 355 { 356 typename ResGW::NodeIt n; 357 for(res_graph.first(n); res_graph.valid(n); res_graph.next(n)) { 358 res_graph_to_F.set(n, F.addNode()); 359 } 357 360 } 358 361 … … 364 367 //Making F to the graph containing the edges of the residual graph 365 368 //which are in some shortest paths 366 for(typename FilterResGW::EdgeIt e=filter_res_graph.template first<typename FilterResGW::EdgeIt>(); filter_res_graph.valid(e); filter_res_graph.next(e)) { 367 //if (dist.get(res_graph.head(e))==dist.get(res_graph.tail(e))+1) { 369 { 370 typename FilterResGW::EdgeIt e; 371 for(filter_res_graph.first(e); filter_res_graph.valid(e); filter_res_graph.next(e)) { 372 //if (dist.get(res_graph.head(e))==dist.get(res_graph.tail(e))+1) { 368 373 typename MG::Edge f=F.addEdge(res_graph_to_F.get(res_graph.tail(e)), res_graph_to_F.get(res_graph.head(e))); 369 374 original_edge.update(); … … 372 377 residual_capacity.set(f, res_graph.resCap(e)); 373 378 //} 379 } 374 380 } 375 381 … … 447 453 MG F; 448 454 typename ResGW::NodeMap<typename MG::Node> res_graph_to_F(res_graph); 449 for(typename ResGW::NodeIt n=res_graph.template first<typename ResGW::NodeIt>(); res_graph.valid(n); res_graph.next(n)) { 450 res_graph_to_F.set(n, F.addNode()); 455 { 456 typename ResGW::NodeIt n; 457 for(res_graph.first(n); res_graph.valid(n); res_graph.next(n)) { 458 res_graph_to_F.set(n, F.addNode()); 459 } 451 460 } 452 461 
src/work/iterator_bfs_demo.cc
r265 r279 34 34 typedef Graph::Node Node; 35 35 typedef Graph::Edge Edge; 36 //typedef Graph::NodeIt NodeIt;37 //typedef Graph::EdgeIt EdgeIt;38 //typedef Graph::OutEdgeIt OutEdgeIt;39 //typedef Graph::InEdgeIt InEdgeIt;40 //typedef Graph::SymEdgeIt SymEdgeIt;41 36 42 37 Graph G; … … 100 95 101 96 cout << "bfs and dfs iterator demo on the directed graph" << endl; 102 for(GW::NodeIt n=gw.first<GW::NodeIt>(); 103 gw.valid(n); 104 gw.next(n)) { 97 for(GW::NodeIt n(gw); gw.valid(n); gw.next(n)) { 105 98 cout << node_name.get(n) << ": "; 106 99 cout << "out edges: "; 107 for(GW::OutEdgeIt e =gw.first<GW::OutEdgeIt>(n); gw.valid(e); gw.next(e))100 for(GW::OutEdgeIt e(gw, n); gw.valid(e); gw.next(e)) 108 101 cout << edge_name.get(e) << " "; 109 102 cout << "in edges: "; 110 for(GW::InEdgeIt e =gw.first<GW::InEdgeIt>(n); gw.valid(e); gw.next(e))103 for(GW::InEdgeIt e(gw, n); gw.valid(e); gw.next(e)) 111 104 cout << edge_name.get(e) << " "; 112 105 cout << endl; … … 178 171 179 172 cout << "bfs and dfs iterator demo on the reversed directed graph" << endl; 180 for(GW::NodeIt n =gw.first<GW::NodeIt>(); gw.valid(n); gw.next(n)) {173 for(GW::NodeIt n(gw); gw.valid(n); gw.next(n)) { 181 174 cout << node_name.get(n) << ": "; 182 175 cout << "out edges: "; 183 for(GW::OutEdgeIt e =gw.first<GW::OutEdgeIt>(n); gw.valid(e); gw.next(e))176 for(GW::OutEdgeIt e(gw, n); gw.valid(e); gw.next(e)) 184 177 cout << edge_name.get(e) << " "; 185 178 cout << "in edges: "; 186 for(GW::InEdgeIt e =gw.first<GW::InEdgeIt>(n); gw.valid(e); gw.next(e))179 for(GW::InEdgeIt e(gw, n); gw.valid(e); gw.next(e)) 187 180 cout << edge_name.get(e) << " "; 188 181 cout << endl; … … 254 247 255 248 cout << "bfs and dfs iterator demo on the undirected graph" << endl; 256 for(GW::NodeIt n =gw.first<GW::NodeIt>(); gw.valid(n); gw.next(n)) {249 for(GW::NodeIt n(gw); gw.valid(n); gw.next(n)) { 257 250 cout << node_name.get(n) << ": "; 258 251 cout << "out edges: "; 259 for(GW::OutEdgeIt e =gw.first<GW::OutEdgeIt>(n); gw.valid(e); gw.next(e))252 for(GW::OutEdgeIt e(gw, n); gw.valid(e); gw.next(e)) 260 253 cout << edge_name.get(e) << " "; 261 254 cout << "in edges: "; 262 for(GW::InEdgeIt e =gw.first<GW::InEdgeIt>(n); gw.valid(e); gw.next(e))255 for(GW::InEdgeIt e(gw, n); gw.valid(e); gw.next(e)) 263 256 cout << edge_name.get(e) << " "; 264 257 cout << endl; 
src/work/list_graph.h
r265 r279 310 310 bool valid(Edge e) const { return e.valid(); } 311 311 312 template <typename It> It getNext(It it) const {313 It tmp(it); next(tmp); return tmp; }312 // template <typename It> It getNext(It it) const { 313 // It tmp(it); next(tmp); return tmp; } 314 314 // NodeIt& next(NodeIt& it) const { return ++it; } 315 315 // EdgeIt& next(EdgeIt& it) const { return ++it; } 
src/work/marci/graph_wrapper.h
r275 r279 449 449 // }; 450 450 451 452 451 template<typename GraphWrapper> 453 452 class RevGraphWrapper : public GraphWrapperSkeleton<GraphWrapper> { … … 455 454 typedef typename GraphWrapperSkeleton<GraphWrapper>::Node Node; 456 455 typedef typename GraphWrapperSkeleton<GraphWrapper>::Edge Edge; 456 //FIXME 457 //If GraphWrapper::OutEdgeIt is not defined 458 //and we do not want to use RevGraphWrapper::InEdgeIt, 459 //this won't work, because of typedef 460 //OR 461 //graphs have to define their nonexisting iterators to void 462 //Unfortunately all the typedefs are instantiated in templates, 463 //unlike other stuff 457 464 typedef typename GraphWrapperSkeleton<GraphWrapper>::OutEdgeIt InEdgeIt; 458 465 typedef typename GraphWrapperSkeleton<GraphWrapper>::InEdgeIt OutEdgeIt; … … 703 710 class Edge { 704 711 friend class UndirGraphWrapper<GraphWrapper>; 712 protected: 705 713 bool out_or_in; //true iff out 706 714 GraphOutEdgeIt out;
Note: See TracChangeset
for help on using the changeset viewer.