diff -r d33813af6e50 -r 99014d576aed src/work/marci_max_flow.hh --- a/src/work/marci_max_flow.hh Mon Jan 12 11:49:56 2004 +0000 +++ b/src/work/marci_max_flow.hh Mon Jan 12 11:50:52 2004 +0000 @@ -94,40 +94,6 @@ typedef typename res_graph_type::res_out_edge_it out_edge_iterator; }; - template - struct flow_visitor { - typedef typename graph_traits::node_iterator node_iterator; - typedef typename graph_traits::edge_iterator edge_iterator; - typedef typename graph_traits::each_node_iterator each_node_iterator; - typedef typename graph_traits::out_edge_iterator out_edge_iterator; - graph_type& G; - pred_type& pred; - free_type& free; - flow_visitor(graph_type& _G, pred_type& _pred, free_type& _free) : G(_G), pred(_pred), free(_free) { } - void at_previously_reached(out_edge_iterator& e) { - //node_iterator v=G.tail(e); - //node_iterator w=G.head(e); - //std::cout<"<"< struct max_flow_type { @@ -152,55 +118,55 @@ typedef res_graph_type aug_graph_type; aug_graph_type res_graph(G, flow, capacity); - typedef std::queue::out_edge_iterator> bfs_queue_type; - bfs_queue_type bfs_queue; - //bfs_queue.push(res_graph.first_out_edge(s)); - - typedef node_property_vector reached_type; - //reached_type reached(res_graph, false); - reached_type reached(res_graph); - //reached.put(s, true); - - typedef node_property_vector::edge_iterator> pred_type; - pred_type pred(res_graph); - pred.put(s, res_graph.invalid_edge()); - - typedef node_property_vector free_type; - free_type free(res_graph); - - typedef flow_visitor visitor_type; - visitor_type vis(res_graph, pred, free); - - bfs_iterator< aug_graph_type, reached_type, visitor_type > - res_bfs(res_graph, bfs_queue, reached, vis); - - //for(graph_traits::each_node_iterator i=res_graph.first_node(); i.is_valid(); ++i) { - //for(graph_traits::out_edge_iterator j=res_graph.first_out_edge(i); j.is_valid(); ++j) { - // std::cout<<"("<"<::out_edge_iterator> bfs_queue_type; + bfs_queue_type bfs_queue; bfs_queue.push(res_graph.first_out_edge(s)); - - for(graph_traits::each_node_iterator i=res_graph.first_node(); i.is_valid(); ++i) { reached.put(i, false); } + + typedef node_property_vector reached_type; + //reached_type reached(res_graph); + //for(graph_traits::each_node_iterator i=res_graph.first_node(); i.is_valid(); ++i) { reached.put(i, false); } + reached_type reached(res_graph, false); reached.put(s, true); + bfs_iterator1< aug_graph_type, reached_type > + res_bfs(res_graph, bfs_queue, reached); + + typedef node_property_vector::edge_iterator> pred_type; + pred_type pred(res_graph); + pred.put(s, res_graph.invalid_edge()); + + typedef node_property_vector free_type; + free_type free(res_graph); + //searching for augmenting path - while ( /*std::cin>>c &&*/ res_bfs.is_valid() ) { - res_bfs.process(); - //if (res_graph.head(graph_traits::out_edge_iterator(res_bfs))==t) break; + while ( res_bfs.is_valid() ) { + //std::cout<<"KULSO ciklus itt jar: "<"<::edge_iterator e; + e=res_bfs; + node_iterator v=res_graph.tail(e); + node_iterator w=res_graph.head(e); + //std::cout<"<>c && !res_bfs.finished() && res_graph.head(res_bfs.current())!=t; res_bfs.next()) { res_bfs.process(); } if (reached.get(t)) { augment=true; node_iterator n=t; @@ -215,7 +181,7 @@ std::cout<::each_edge_iterator e=G.first_edge(); e.is_valid(); ++e) { std::cout<<"("<"<