19 #include <boost/graph/adjacency_list.hpp>
23 std::vector<std::pair<int,int>> edges_p{{0,3},{1,3},
31 const int vertices_num = 9;
32 std::vector<int> cost_edges{100,100,100,100,100,100,10,10,10,10,10,10,1,1,1};
34 std::vector<int> terminals = { 0, 1, 2 };
35 boost::adjacency_list<
36 boost::vecS, boost::vecS, boost::undirectedS,
37 boost::property<boost::vertex_index_t, int,
38 boost::property<boost::vertex_color_t, int>>,
39 boost::property<boost::edge_weight_t, int>
40 > graph(edges_p.begin(), edges_p.end(), cost_edges.begin(), vertices_num);
42 for (std::size_t i = 1; i <= terminals.size(); ++i) {
43 put(boost::vertex_color, graph, terminals[i - 1], i);
47 std::vector<std::pair<int,int>> vertices_parts;
51 std::cout <<
"cost cut: " << cost_cut << std::endl;
52 std::cout <<
"vertices (part)" << std::endl;
53 for(
auto i: vertices_parts) {
54 std::cout <<
" " << i.first <<
" ( " << i.second <<
" )" << std::endl;
56 paal::lp::glp::free_env();
int main()
[Multiway Cut Example]
auto multiway_cut(const Graph &g, OutputIterator out, const boost::bgl_named_params< P, T, R > ¶ms, Rand &&random_engine=std::default_random_engine(5426u)) -> typename boost::property_traits< puretype(boost::choose_const_pmap(get_param(params, boost::edge_weight), g, boost::edge_weight))>::value_type
detail