<legend id='NSpk1'><style id='NSpk1'><dir id='NSpk1'><q id='NSpk1'></q></dir></style></legend>
  • <i id='NSpk1'><tr id='NSpk1'><dt id='NSpk1'><q id='NSpk1'><span id='NSpk1'><b id='NSpk1'><form id='NSpk1'><ins id='NSpk1'></ins><ul id='NSpk1'></ul><sub id='NSpk1'></sub></form><legend id='NSpk1'></legend><bdo id='NSpk1'><pre id='NSpk1'><center id='NSpk1'></center></pre></bdo></b><th id='NSpk1'></th></span></q></dt></tr></i><div id='NSpk1'><tfoot id='NSpk1'></tfoot><dl id='NSpk1'><fieldset id='NSpk1'></fieldset></dl></div>
  • <tfoot id='NSpk1'></tfoot>

        <bdo id='NSpk1'></bdo><ul id='NSpk1'></ul>

      <small id='NSpk1'></small><noframes id='NSpk1'>

        一个图的割集,Boost Graph Library

        时间:2023-06-29
        • <small id='hMDa9'></small><noframes id='hMDa9'>

          <legend id='hMDa9'><style id='hMDa9'><dir id='hMDa9'><q id='hMDa9'></q></dir></style></legend>

                  <bdo id='hMDa9'></bdo><ul id='hMDa9'></ul>
                  <tfoot id='hMDa9'></tfoot>
                • <i id='hMDa9'><tr id='hMDa9'><dt id='hMDa9'><q id='hMDa9'><span id='hMDa9'><b id='hMDa9'><form id='hMDa9'><ins id='hMDa9'></ins><ul id='hMDa9'></ul><sub id='hMDa9'></sub></form><legend id='hMDa9'></legend><bdo id='hMDa9'><pre id='hMDa9'><center id='hMDa9'></center></pre></bdo></b><th id='hMDa9'></th></span></q></dt></tr></i><div id='hMDa9'><tfoot id='hMDa9'></tfoot><dl id='hMDa9'><fieldset id='hMDa9'></fieldset></dl></div>
                    <tbody id='hMDa9'></tbody>
                  本文介绍了一个图的割集,Boost Graph Library的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我一直在努力弄清楚如何做到这一点.我对快速找到图形的割集很感兴趣.我知道 BGL 支持通过迭代来查找割集,例如 edmonds_karp_max_flow 支持的 colorMap 参数.Gomory Hu 算法需要多次调用最小割算法.

                  我希望得到的结果是一个多图,其中包含:(颜色,顶点)

                  以下代码尝试重写 Boost Graph 库中的示例,以将多重映射用于 associative_property_map.可以通过以下方式编译代码:铛 -lboost_graph -o edmonds_karp edmonds_karp.cpp或 g++ 而不是 clang.我不明白由此产生的错误.

                  #include #include #include <字符串>#include #include #include <boost/graph/edmonds_karp_max_flow.hpp>#include #include #include #include #include int main(){使用命名空间提升;typedef adjacency_list_traits <vecS, vecS, 定向 >性状;typedef adjacency_list <列表、向量、定向、财产vertex_name_t, std::string >,财产edge_capacity_t,长,财产edge_residual_capacity_t,长,财产edge_reverse_t, Traits::edge_descriptor >>>>图形;图g;property_map <图,edge_capacity_t >::type容量 = 获取(边缘容量,g);property_map <图,edge_reverse_t >::type rev = get(edge_reverse, g);property_map <图,edge_residual_capacity_t >::type剩余容量 = 获取(边缘剩余容量,g);std::multimap颜色图;boost::associative_property_map<std::map>颜色图(颜色图);特性::vertex_descriptor s, t;read_dimacs_max_flow(g, 容量, rev, s, t);std::vectorpred(num_vertices(g));长流 = edmonds_karp_max_flow(g,s,t,容量,residual_capacity,rev,make_iterator_property_map(color_map.begin()),&pred[0]);std::cout <<"c 总流量:" <<std::endl;std::cout <<s"<<流量<<std::endl <<std::endl;std::cout <<c流量值:"<<std::endl;graph_traits <图 >::vertex_iterator u_iter, u_end;graph_traits <图 >::out_edge_iterator ei, e_end;for (boost::tie(u_iter, u_end) = vertices(g); u_iter != u_end; ++u_iter)for (boost::tie(ei, e_end) = out_edges(*u_iter, g); ei != e_end; ++ei)如果(容量[*ei] > 0)std::cout <<f"<<*u_iter<<" " <<目标(*ei,g)<<""<<(容量[*ei] - 残差容量[*ei])<
                  
                  <tfoot id='MpOHd'></tfoot>

                    1. <i id='MpOHd'><tr id='MpOHd'><dt id='MpOHd'><q id='MpOHd'><span id='MpOHd'><b id='MpOHd'><form id='MpOHd'><ins id='MpOHd'></ins><ul id='MpOHd'></ul><sub id='MpOHd'></sub></form><legend id='MpOHd'></legend><bdo id='MpOHd'><pre id='MpOHd'><center id='MpOHd'></center></pre></bdo></b><th id='MpOHd'></th></span></q></dt></tr></i><div id='MpOHd'><tfoot id='MpOHd'></tfoot><dl id='MpOHd'><fieldset id='MpOHd'></fieldset></dl></div>
                    2. <legend id='MpOHd'><style id='MpOHd'><dir id='MpOHd'><q id='MpOHd'></q></dir></style></legend>
                        <bdo id='MpOHd'></bdo><ul id='MpOHd'></ul>

                        1. <small id='MpOHd'></small><noframes id='MpOHd'>

                            <tbody id='MpOHd'></tbody>