コード例 #1
0
void maximum_flow_path(Graph& g,
                       typename graph_traits<Graph>::vertex_descriptor s,
                       const bgl_named_params<P, T, R>& params) {
    typedef typename property_traits<typename property_map<Graph, edge_weight_t>::type>::value_type WeightDataType;
    dijkstra_shortest_paths(g,
                            s,
                            params.distance_compare(std::greater<WeightDataType>()).
                                    distance_combine([](WeightDataType a, WeightDataType b) { return std::min(a, b); }).
                                    distance_inf(WeightDataType()).
                                    distance_zero(std::numeric_limits<WeightDataType>::max())
    );
}
コード例 #2
0
 inline void
 prim_mst_impl(const Graph& G,
               typename graph_traits<Graph>::vertex_descriptor s,
               const bgl_named_params<P,T,R>& params,
               Weight)
 {
   typedef typename property_traits<Weight>::value_type W;
   std::less<W> compare;
   detail::_project2nd<W,W> combine;
   dijkstra_shortest_paths(G, s, params.distance_compare(compare).
                           distance_combine(combine));
 }
コード例 #3
0
void maximum_flow_algorithm(Graph& g,
                                typename graph_traits<Graph>::vertex_descriptor s,
                                const bgl_named_params<P, T, R>& params) {
    typedef typename property_traits<typename property_map<Graph, edge_weight_t>::type>::value_type WT;

//    dummy_property_map p_map;
//    typedef decltype(choose_param(get_param(params, vertex_distance), p_map)) DistanceMap;
//    std::cout<< typeid(property_map<Graph, edge_weight_t>).name() << std::endl;
//    typedef typename property_traits<DistanceMap>::value_type DT;

    dijkstra_shortest_paths(g, s, params.distance_compare(std::greater<WT>()).
            distance_combine([](WT a, WT b) { return std::min(a, b); }).
            distance_inf(WT()).
            distance_zero(std::numeric_limits<WT>::max()));

}