16 #ifndef PAAL_STEINER_UTILS_HPP
17 #define PAAL_STEINER_UTILS_HPP
19 #define BOOST_RESULT_OF_USE_DECLTYPE
25 #include <boost/graph/prim_minimum_spanning_tree.hpp>
26 #include <boost/range/join.hpp>
39 template <
typename Metric,
typename Terminals,
typename Result>
42 using Vertex =
typename data_structures::metric_traits<Metric>::VertexType;
45 auto all_elements = boost::range::join(terminals, steiner_vertices);
49 std::vector<std::size_t> pm(all_elements.size());
50 boost::prim_minimum_spanning_tree(g, &pm[0]);
54 for (
auto i :
irange(pm.size())) {
55 cost += idx_m(i, pm[i]);
64 #endif // PAAL_STEINER_UTILS_HPP
adjacency_matrix< Metric >::type metric_to_bgl_with_index(const Metric &m, Vertices &&vertices, bimap< typename boost::range_value< Vertices >::type > &idx)
produces graph from metric with index
metric_on_idx< Metric, Bimap, Strategy > make_metric_on_idx(Metric &&m, Bimap &&b)
make for metric_on_idx
static data_structures::metric_traits< Metric >::DistanceType count_cost(const Result &steiner_vertices, const Terminals &terminals, const Metric &cost_map)
auto irange(T begin, T end)
irange
Terminals
enum indicates if given color represents terminal or NONTERMINAL.
puretype(std::declval< Metric >()(std::declval< VertexType >(), std::declval< VertexType >())) DistanceType
Distance type.