COIN-OR::LEMON - Graph Library

Changeset 500:1a45623b4796 in lemon-0.x for src/work/marci


Ignore:
Timestamp:
04/30/04 19:48:50 (21 years ago)
Author:
marci
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@660
Message:

misc

Location:
src/work/marci
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/work/marci/bipartite_graph_wrapper.h

    r499 r500  
    4747
    4848    BipartiteGraphWrapper(Graph& _graph, SFalseTTrueMap& _s_false_t_true_map)
    49       : GraphWrapper<Graph>(_graph), s_false_t_true_map(&_s_false_t_true_map),
    50       S_CLASS(false), T_CLASS(true) { }
     49      : GraphWrapper<Graph>(_graph),
     50        s_false_t_true_map(&_s_false_t_true_map),
     51        S_CLASS(false), T_CLASS(true) { }
    5152    typedef typename GraphWrapper<Graph>::Node Node;
    5253    //using GraphWrapper<Graph>::NodeIt;
     
    198199    typedef typename Parent::Edge Edge;
    199200    BipartiteGraph() : BipartiteGraphWrapper<Graph>(),
    200                        gr(), bipartite_map(gr),
     201                       gr(), bipartite_map(gr, -1),
    201202                       s_false_t_true_map(bipartite_map) {
    202203      Parent::setGraph(gr);
  • src/work/marci/bipartite_matching_try_2.cc

    r499 r500  
    6464  std::cin >> m;
    6565 
    66 
     66  std::cout << "Generatig a random bipartite graph..." << std::endl;
    6767  for (int i=0; i<a; ++i) s_nodes.push_back(g.addNode(false));
    6868  for (int i=0; i<b; ++i) t_nodes.push_back(g.addNode(true));
     
    7777  std::cout << std::endl;
    7878
     79  std::cout << "Nodes in T:" << std::endl;
     80  FOR_EACH_INC_LOC(Graph::ClassNodeIt, v, g, g.T_CLASS) std::cout << v << " ";
     81  std::cout << std::endl;
     82  std::cout << "Nodes in S:" << std::endl;
     83  FOR_EACH_INC_LOC(Graph::ClassNodeIt, v, g, g.S_CLASS) std::cout << v << " ";
     84  std::cout << std::endl;
     85
     86  std::cout << "Erasing the first node..." << std::endl;
     87  NodeIt n;
     88  g.first(n);
     89  g.erase(n);
     90  std::cout << "Nodes of the bipartite graph:" << std::endl;
     91  FOR_EACH_GLOB(n, g) std::cout << n << " ";
     92  std::cout << std::endl;
     93
     94  std::cout << "Nodes in T:" << std::endl;
     95  FOR_EACH_INC_LOC(Graph::ClassNodeIt, v, g, g.T_CLASS) std::cout << v << " ";
     96  std::cout << std::endl;
     97  std::cout << "Nodes in S:" << std::endl;
     98  FOR_EACH_INC_LOC(Graph::ClassNodeIt, v, g, g.S_CLASS) std::cout << v << " ";
     99  std::cout << std::endl;
     100
    79101  typedef stGraphWrapper<Graph> stGW;
    80102  stGW stgw(g);
    81103  ConstMap<stGW::Edge, int> const1map(1);
    82 
    83 
    84 
    85104
    86105  Timer ts;
     
    89108  MaxFlow<stGW, int, ConstMap<stGW::Edge, int>, stGW::EdgeMap<int> >
    90109    max_flow_test(stgw, stgw.S_NODE, stgw.T_NODE, const1map, flow);
     110  max_flow_test.run();
    91111//  while (max_flow_test.augmentOnShortestPath()) { }
    92   typedef ListGraph MutableGraph;
     112//  typedef ListGraph MutableGraph;
    93113//  while (max_flow_test.augmentOnBlockingFlow1<MutableGraph>()) {
    94   while (max_flow_test.augmentOnBlockingFlow2()) {
    95    std::cout << max_flow_test.flowValue() << std::endl;
    96   }
     114//  while (max_flow_test.augmentOnBlockingFlow2()) {
     115//   std::cout << max_flow_test.flowValue() << std::endl;
     116//  }
    97117  std::cout << "max flow value: " << max_flow_test.flowValue() << std::endl;
    98118  std::cout << "elapsed time: " << ts << std::endl;
     
    102122  std::cout << std::endl;
    103123
    104   ts.reset();
    105   stGW::EdgeMap<int> pre_flow(stgw);
    106   MaxFlow<stGW, int, ConstMap<stGW::Edge, int>, stGW::EdgeMap<int> >
    107     pre_flow_test(stgw, stgw.S_NODE, stgw.T_NODE, const1map, pre_flow/*, true*/);
    108   pre_flow_test.run();
    109   std::cout << "pre flow value: " << max_flow_test.flowValue() << std::endl;
    110   std::cout << "elapsed time: " << ts << std::endl;
    111 //   FOR_EACH_LOC(stGW::EdgeIt, e, stgw) {
    112 //     std::cout << e << ": " << pre_flow[e] << "\n";
    113 //   }
    114 //   std::cout << "\n";
    115 
    116124  return 0;
    117125}
Note: See TracChangeset for help on using the changeset viewer.