COIN-OR::LEMON - Graph Library

Changeset 75:87623302a68f in lemon-0.x for src/work/marci_graph_demo.cc


Ignore:
Timestamp:
02/16/04 12:29:48 (20 years ago)
Author:
marci
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@98
Message:

.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/work/marci_graph_demo.cc

    r69 r75  
    9595  }
    9696  std::cout << std::endl;
    97 
     97/*
    9898  std::cout << "bfs from the first node" << std::endl;
    9999  bfs<ListGraph> bfs_test(G, G.first<EachNodeIt>());
     
    109109  }
    110110  std::cout<<std::endl;
    111 
     111*/
    112112
    113113  std::cout << "augmenting path flow algorithm test..." << std::endl;
     
    174174  //flowG.setTail(v3_t, v2);
    175175  //flowG.setHead(v3_t, s);
    176 
     176/*
    177177  for(EachNodeIt i=flowG.first<EachNodeIt>(); i.valid(); ++i) {
    178178    std::cout << node_name.get(i) << ": ";
     
    189189    std::cout << node_name.get(flowG.tail(e)) << "-"<< cap.get(e) << "->" << node_name.get(flowG.head(e)) << " ";
    190190  }
    191 
     191*/
    192192  /*
    193193  while (flowG.first<EachEdgeIt>().valid()) {
     
    220220  */
    221221
    222   std::cout << std::endl;
    223   //std::cout << "meg jo" << std::flush;
    224 
    225   ListGraph::EdgeMap<int> flow(flowG, 0);
    226   MaxFlow<ListGraph, int, ListGraph::EdgeMap<int>, ListGraph::EdgeMap<int> > max_flow_test(flowG, s, t, flow, cap);
    227   max_flow_test.run();
    228 
    229   std::cout << "maximum flow: "<< std::endl;
    230   for(EachEdgeIt e=flowG.template first<EachEdgeIt>(); e.valid(); ++e) {
    231     std::cout<<"("<<flowG.tail(e)<< "-"<<flow.get(e)<<"->"<<flowG.head(e)<<") ";
    232   }
    233   std::cout<<std::endl;
    234   std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
     222  //std::cout << std::endl;
     223
     224
     225  {
     226    ListGraph::EdgeMap<int> flow(flowG, 0);
     227    MaxFlow<ListGraph, int, ListGraph::EdgeMap<int>, ListGraph::EdgeMap<int> > max_flow_test(flowG, s, t, flow, cap);
     228    max_flow_test.run();
     229   
     230    std::cout << "maximum flow: "<< std::endl;
     231    for(EachEdgeIt e=flowG.template first<EachEdgeIt>(); e.valid(); ++e) {
     232      std::cout<<"("<<flowG.tail(e)<< "-"<<flow.get(e)<<"->"<<flowG.head(e)<<") ";
     233    }
     234    std::cout<<std::endl;
     235    std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
     236  }
     237
     238  {
     239    std::list<NodeIt> S;
     240    S.push_back(s); S.push_back(v3);
     241    std::list<NodeIt> T;
     242    T.push_back(t);
     243
     244    ListGraph::EdgeMap<int> flow(flowG, 0);
     245    MaxFlow2<ListGraph, int, ListGraph::EdgeMap<int>, ListGraph::EdgeMap<int> > max_flow_test(flowG, S, T, flow, cap);
     246    max_flow_test.run();
     247   
     248    std::cout << "maximum flow: "<< std::endl;
     249    for(EachEdgeIt e=flowG.template first<EachEdgeIt>(); e.valid(); ++e) {
     250      std::cout<<"("<<flowG.tail(e)<< "-"<<flow.get(e)<<"->"<<flowG.head(e)<<") ";
     251    }
     252    std::cout<<std::endl;
     253    std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
     254  }
    235255
    236256  return 0;
Note: See TracChangeset for help on using the changeset viewer.