COIN-OR::LEMON - Graph Library

Changeset 279:be43902fadb7 in lemon-0.x


Ignore:
Timestamp:
04/03/04 16:22:33 (16 years ago)
Author:
marci
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@393
Message:

minor changes

Location:
src/work
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/work/bfs_iterator.h

    r260 r279  
    797797      actual_node=s;
    798798      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);
    800802    }
    801803    DfsIterator5<GraphWrapper, /*OutEdgeIt,*/ ReachedMap>&
     
    807809        actual_node=w;
    808810        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);
    810814          reached.set(w, true);
    811815          b_node_newly_reached=true;
  • src/work/edmonds_karp.h

    r269 r279  
    353353      FilterResGW filter_res_graph(res_graph, dist);
    354354      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        }
    357360      }
    358361
     
    364367      //Making F to the graph containing the edges of the residual graph
    365368      //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) {
    368373          typename MG::Edge f=F.addEdge(res_graph_to_F.get(res_graph.tail(e)), res_graph_to_F.get(res_graph.head(e)));
    369374          original_edge.update();
     
    372377          residual_capacity.set(f, res_graph.resCap(e));
    373378          //}
     379        }
    374380      }
    375381
     
    447453      MG F;
    448454      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        }
    451460      }
    452461
  • src/work/iterator_bfs_demo.cc

    r265 r279  
    3434  typedef Graph::Node Node;
    3535  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;
    4136 
    4237  Graph G;
     
    10095   
    10196    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)) {
    10598      cout << node_name.get(n) << ": ";
    10699      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))
    108101        cout << edge_name.get(e) << " ";
    109102      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))
    111104        cout << edge_name.get(e) << " ";
    112105      cout << endl;
     
    178171   
    179172    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)) {
    181174      cout << node_name.get(n) << ": ";
    182175      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))
    184177        cout << edge_name.get(e) << " ";
    185178      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))
    187180        cout << edge_name.get(e) << " ";
    188181      cout << endl;
     
    254247   
    255248    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)) {
    257250      cout << node_name.get(n) << ": ";
    258251      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))
    260253        cout << edge_name.get(e) << " ";
    261254      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))
    263256        cout << edge_name.get(e) << " ";
    264257      cout << endl;
  • src/work/list_graph.h

    r265 r279  
    310310    bool valid(Edge e) const { return e.valid(); }
    311311   
    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; }
    314314//     NodeIt& next(NodeIt& it) const { return ++it; }
    315315//     EdgeIt& next(EdgeIt& it) const { return ++it; }
  • src/work/marci/graph_wrapper.h

    r275 r279  
    449449//   };
    450450
    451 
    452451  template<typename GraphWrapper>
    453452  class RevGraphWrapper : public GraphWrapperSkeleton<GraphWrapper> {
     
    455454    typedef typename GraphWrapperSkeleton<GraphWrapper>::Node Node;
    456455    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 non-existing iterators to void
     462    //Unfortunately all the typedefs are instantiated in templates,
     463    //unlike other stuff
    457464    typedef typename GraphWrapperSkeleton<GraphWrapper>::OutEdgeIt InEdgeIt;
    458465    typedef typename GraphWrapperSkeleton<GraphWrapper>::InEdgeIt OutEdgeIt;
     
    703710    class Edge {
    704711      friend class UndirGraphWrapper<GraphWrapper>;
     712    protected:
    705713      bool out_or_in; //true iff out
    706714      GraphOutEdgeIt out;
Note: See TracChangeset for help on using the changeset viewer.