src/work/marci_graph_demo.cc
changeset 65 a63cef252656
parent 49 f00a4f7e2149
child 69 24c2c2989e0f
equal deleted inserted replaced
3:3eeee2bb1010 4:62967e4c6d37
   163     for(InEdgeIt j=flowG.first<InEdgeIt>(i); j.valid(); ++j) 
   163     for(InEdgeIt j=flowG.first<InEdgeIt>(i); j.valid(); ++j) 
   164       std::cout << node_name.get(flowG.tail(j)) << "-"<< cap.get(j) << "->" << node_name.get(flowG.head(j)) << " ";
   164       std::cout << node_name.get(flowG.tail(j)) << "-"<< cap.get(j) << "->" << node_name.get(flowG.head(j)) << " ";
   165     std::cout << std::endl;
   165     std::cout << std::endl;
   166   }
   166   }
   167 
   167 
       
   168   //flowG.deleteEdge(s_v1);
       
   169   //flowG.deleteEdge(s_v2);
       
   170   //flowG.deleteEdge(v1_v2);
       
   171   //flowG.deleteEdge(v1_v3);
       
   172   
       
   173 
   168   //flowG.setTail(v3_t, v2);
   174   //flowG.setTail(v3_t, v2);
   169   //flowG.setHead(v3_t, s);
   175   //flowG.setHead(v3_t, s);
   170 
   176 
   171   for(EachNodeIt i=flowG.first<EachNodeIt>(); i.valid(); ++i) { 
   177   for(EachNodeIt i=flowG.first<EachNodeIt>(); i.valid(); ++i) { 
   172     std::cout << node_name.get(i) << ": ";
   178     std::cout << node_name.get(i) << ": ";
   177     for(InEdgeIt j=flowG.first<InEdgeIt>(i); j.valid(); ++j) 
   183     for(InEdgeIt j=flowG.first<InEdgeIt>(i); j.valid(); ++j) 
   178       std::cout << node_name.get(flowG.tail(j)) << "-"<< cap.get(j) << "->" << node_name.get(flowG.head(j)) << " ";
   184       std::cout << node_name.get(flowG.tail(j)) << "-"<< cap.get(j) << "->" << node_name.get(flowG.head(j)) << " ";
   179     std::cout << std::endl;
   185     std::cout << std::endl;
   180   }
   186   }
   181   
   187   
       
   188   for(EachEdgeIt e=flowG.first<EachEdgeIt>(); e.valid(); ++e) {
       
   189     std::cout << node_name.get(flowG.tail(e)) << "-"<< cap.get(e) << "->" << node_name.get(flowG.head(e)) << " ";
       
   190   }
   182 
   191 
   183   /*
   192   /*
   184   while (flowG.first<EachEdgeIt>().valid()) {
   193   while (flowG.first<EachEdgeIt>().valid()) {
   185     flowG.deleteEdge(flowG.first<EachEdgeIt>());
   194     flowG.deleteEdge(flowG.first<EachEdgeIt>());
   186     for(EachNodeIt i=flowG.first<EachNodeIt>(); i.valid(); ++i) { 
   195     for(EachNodeIt i=flowG.first<EachNodeIt>(); i.valid(); ++i) { 
   208       std::cout << std::endl;
   217       std::cout << std::endl;
   209     }
   218     }
   210   }
   219   }
   211   */
   220   */
   212 
   221 
   213   //ListGraph::EdgeMap<int> flow(flowG, 0);
   222   std::cout << std::endl;
   214   //ResGraph<ListGraph, int> res_graph(flowG, cap, flow); 
   223   //std::cout << "meg jo" << std::flush;
   215   max_flow_type<ListGraph, int> max_flow_test(flowG, s, t, cap);
   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);
   216   max_flow_test.run();
   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;
   217 
   234 
   218   return 0;
   235   return 0;
   219 }
   236 }