annotate DEPENDENCIES/generic/include/boost/graph/find_flow_cost.hpp @ 118:770eb830ec19 emscripten

Typo fix
author Chris Cannam
date Wed, 18 May 2016 16:14:08 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 //=======================================================================
Chris@16 2 // Copyright 2013 University of Warsaw.
Chris@16 3 // Authors: Piotr Wygocki
Chris@16 4 //
Chris@16 5 // Distributed under the Boost Software License, Version 1.0. (See
Chris@16 6 // accompanying file LICENSE_1_0.txt or copy at
Chris@16 7 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 8 //=======================================================================
Chris@16 9 #ifndef BOOST_GRAPH_FIND_FLOW_COST_HPP
Chris@16 10 #define BOOST_GRAPH_FIND_FLOW_COST_HPP
Chris@16 11
Chris@16 12 #include <boost/graph/iteration_macros.hpp>
Chris@16 13
Chris@16 14 namespace boost {
Chris@16 15
Chris@16 16 template<class Graph, class Capacity, class ResidualCapacity, class Weight>
Chris@16 17 typename property_traits<typename property_map < Graph, edge_capacity_t >::type>::value_type
Chris@16 18 find_flow_cost(const Graph & g, Capacity capacity, ResidualCapacity residual_capacity, Weight weight) {
Chris@16 19 typedef typename property_traits<typename property_map<Graph, edge_weight_t>::const_type>::value_type Cost;
Chris@16 20
Chris@16 21 Cost cost = 0;
Chris@16 22 BGL_FORALL_EDGES_T(e, g, Graph) {
Chris@16 23 if(get(capacity, e) > Cost(0)) {
Chris@16 24 cost += (get(capacity, e) - get(residual_capacity, e)) * get(weight, e);
Chris@16 25 }
Chris@16 26 }
Chris@16 27 return cost;
Chris@16 28 }
Chris@16 29
Chris@16 30 template <class Graph, class P, class T, class R>
Chris@16 31 typename property_traits<typename property_map < Graph, edge_capacity_t >::type>::value_type
Chris@16 32 find_flow_cost(const Graph & g,
Chris@16 33 const bgl_named_params<P, T, R>& params) {
Chris@16 34 return find_flow_cost(g,
Chris@16 35 choose_const_pmap(get_param(params, edge_capacity), g, edge_capacity),
Chris@16 36 choose_const_pmap(get_param(params, edge_residual_capacity),
Chris@16 37 g, edge_residual_capacity),
Chris@16 38 choose_const_pmap(get_param(params, edge_weight), g, edge_weight));
Chris@16 39 }
Chris@16 40
Chris@16 41 template <class Graph>
Chris@16 42 typename property_traits<typename property_map < Graph, edge_capacity_t >::type>::value_type
Chris@16 43 find_flow_cost(const Graph &g) {
Chris@16 44 bgl_named_params<int, buffer_param_t> params(0);
Chris@16 45 return find_flow_cost(g, params);
Chris@16 46 }
Chris@16 47
Chris@16 48
Chris@16 49 } //boost
Chris@16 50
Chris@16 51 #endif /* BOOST_GRAPH_FIND_FLOW_COST_HPP */
Chris@16 52