/usr/include/boost/graph
NameSizeModeActions
detail/-0755rm
distributed/-0755rm
parallel/-0755rm
planar_detail/-0755rm
property_maps/-0755rm
accounting.hpp8760644editdlrm
adjacency_iterator.hpp28990644editdlrm
adjacency_list.hpp136920644editdlrm
adjacency_list_io.hpp118490644editdlrm
adjacency_matrix.hpp457430644editdlrm
adj_list_serialize.hpp45230644editdlrm
astar_search.hpp267360644editdlrm
bandwidth.hpp29920644editdlrm
bc_clustering.hpp59370644editdlrm
bellman_ford_shortest_paths.hpp82290644editdlrm
betweenness_centrality.hpp262900644editdlrm
biconnected_components.hpp167010644editdlrm
bipartite.hpp134920644editdlrm
boyer_myrvold_planar_test.hpp98490644editdlrm
boykov_kolmogorov_max_flow.hpp473420644editdlrm
breadth_first_search.hpp147510644editdlrm
bron_kerbosch_all_cliques.hpp117360644editdlrm
buffer_concepts.hpp24290644editdlrm
chrobak_payne_drawing.hpp86410644editdlrm
circle_layout.hpp19240644editdlrm
closeness_centrality.hpp60570644editdlrm
clustering_coefficient.hpp57260644editdlrm
compressed_sparse_row_graph.hpp698870644editdlrm
connected_components.hpp41340644editdlrm
copy.hpp212250644editdlrm
core_numbers.hpp136630644editdlrm
create_condensation_graph.hpp31590644editdlrm
cuthill_mckee_ordering.hpp59920644editdlrm
cycle_canceling.hpp66450644editdlrm
dag_shortest_paths.hpp60640644editdlrm
degree_centrality.hpp42360644editdlrm
depth_first_search.hpp154300644editdlrm
dijkstra_shortest_paths.hpp236870644editdlrm
dijkstra_shortest_paths_no_color_map.hpp96200644editdlrm
dimacs.hpp104480644editdlrm
directed_graph.hpp242140644editdlrm
dll_import_export.hpp8920644editdlrm
dominator_tree.hpp175530644editdlrm
eccentricity.hpp46110644editdlrm
edge_coloring.hpp68090644editdlrm
edge_connectivity.hpp67960644editdlrm
edge_list.hpp99480644editdlrm
edmonds_karp_max_flow.hpp101770644editdlrm
edmunds_karp_max_flow.hpp9820644editdlrm
erdos_renyi_generator.hpp72570644editdlrm
exception.hpp14660644editdlrm
exterior_property.hpp42890644editdlrm
filtered_graph.hpp200980644editdlrm
find_flow_cost.hpp18590644editdlrm
floyd_warshall_shortest.hpp85100644editdlrm
fruchterman_reingold.hpp173250644editdlrm
geodesic_distance.hpp80150644editdlrm
graphml.hpp134600644editdlrm
graphviz.hpp335030644editdlrm
graph_archetypes.hpp110080644editdlrm
graph_as_tree.hpp45320644editdlrm
graph_concepts.hpp197850644editdlrm
graph_mutability_traits.hpp49950644editdlrm
graph_selectors.hpp12740644editdlrm
graph_stats.hpp43940644editdlrm
graph_traits.hpp130650644editdlrm
graph_utility.hpp161820644editdlrm
grid_graph.hpp338300644editdlrm
gursoy_atun_layout.hpp132480644editdlrm
hawick_circuits.hpp145930644editdlrm
howard_cycle_ratio.hpp231070644editdlrm
incremental_components.hpp82240644editdlrm
isomorphism.hpp263080644editdlrm
is_kuratowski_subgraph.hpp102600644editdlrm
is_straight_line_drawing.hpp72300644editdlrm
iteration_macros.hpp116590644editdlrm
iteration_macros_undef.hpp6730644editdlrm
johnson_all_pairs_shortest.hpp76460644editdlrm
kamada_kawai_spring_layout.hpp280480644editdlrm
king_ordering.hpp121010644editdlrm
kruskal_min_spanning_tree.hpp57430644editdlrm
labeled_graph.hpp309140644editdlrm
leda_graph.hpp287890644editdlrm
lookup_edge.hpp18940644editdlrm
loop_erased_random_walk.hpp44360644editdlrm
make_biconnected_planar.hpp35130644editdlrm
make_connected.hpp26450644editdlrm
make_maximal_planar.hpp75780644editdlrm
matrix_as_graph.hpp72270644editdlrm
maximum_adjacency_search.hpp151250644editdlrm
maximum_weighted_matching.hpp497220644editdlrm
max_cardinality_matching.hpp310000644editdlrm
mcgregor_common_subgraphs.hpp434700644editdlrm
mesh_graph_generator.hpp56160644editdlrm
metis.hpp109820644editdlrm
metric_tsp_approx.hpp108090644editdlrm
minimum_degree_ordering.hpp270870644editdlrm
named_function_params.hpp396390644editdlrm
named_graph.hpp206140644editdlrm
neighbor_bfs.hpp117630644editdlrm
numeric_values.hpp18140644editdlrm
one_bit_color_map.hpp32770644editdlrm
overloading.hpp15840644editdlrm
page_rank.hpp61640644editdlrm
planar_canonical_ordering.hpp72030644editdlrm
planar_face_traversal.hpp60200644editdlrm
plod_generator.hpp77080644editdlrm
point_traits.hpp7820644editdlrm
prim_minimum_spanning_tree.hpp29600644editdlrm
profile.hpp13270644editdlrm
properties.hpp124170644editdlrm
property_iter_range.hpp43450644editdlrm
push_relabel_max_flow.hpp347370644editdlrm
random.hpp96720644editdlrm
random_layout.hpp9880644editdlrm
random_spanning_tree.hpp57750644editdlrm
read_dimacs.hpp120800644editdlrm
relax.hpp44000644editdlrm
reverse_graph.hpp224020644editdlrm
rmat_graph_generator.hpp192910644editdlrm
r_c_shortest_paths.hpp306730644editdlrm
sequential_vertex_coloring.hpp45620644editdlrm
simple_point.hpp6280644editdlrm
sloan_ordering.hpp155400644editdlrm
smallest_last_ordering.hpp54580644editdlrm
small_world_generator.hpp36700644editdlrm
ssca_graph_generator.hpp65640644editdlrm
stanford_graph.hpp201260644editdlrm
stoer_wagner_min_cut.hpp124150644editdlrm
strong_components.hpp130090644editdlrm
st_connected.hpp28520644editdlrm
subgraph.hpp399960644editdlrm
successive_shortest_path_nonnegative_weights.hpp104130644editdlrm
tiernan_all_cycles.hpp125470644editdlrm
topological_sort.hpp26110644editdlrm
topology.hpp203890644editdlrm
transitive_closure.hpp142600644editdlrm
transitive_reduction.hpp53260644editdlrm
transpose_graph.hpp11980644editdlrm
tree_traits.hpp13380644editdlrm
two_bit_color_map.hpp35100644editdlrm
two_graphs_common_spanning_trees.hpp349960644editdlrm
undirected_dfs.hpp106720644editdlrm
undirected_graph.hpp252760644editdlrm
use_mpi.hpp4370644editdlrm
vector_as_graph.hpp104740644editdlrm
vertex_and_edge_range.hpp55280644editdlrm
vf2_sub_graph_iso.hpp485850644editdlrm
visitors.hpp113180644editdlrm
wavefront.hpp39320644editdlrm
write_dimacs.hpp28890644editdlrm
Edit: /usr/include/boost/graph/howard_cycle_ratio.hpp (23107B)
// Copyright (C) 2006-2009 Dmitry Bufistov and Andrey Parfenov // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_GRAPH_CYCLE_RATIO_HOWARD_HPP #define BOOST_GRAPH_CYCLE_RATIO_HOWARD_HPP #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /** @file howard_cycle_ratio.hpp * @brief The implementation of the maximum/minimum cycle ratio/mean algorithm. * @author Dmitry Bufistov * @author Andrey Parfenov */ namespace boost { /** * The mcr_float is like numeric_limits, but only for floating point types * and only defines infinity() and epsilon(). This class is primarily used * to encapsulate a less-precise epsilon than natively supported by the * floating point type. */ template < typename Float = double > struct mcr_float { typedef Float value_type; static Float infinity() { return std::numeric_limits< value_type >::infinity(); } static Float epsilon() { return Float(-0.005); } }; namespace detail { template < typename FloatTraits > struct min_comparator_props { typedef std::greater< typename FloatTraits::value_type > comparator; static const int multiplier = 1; }; template < typename FloatTraits > struct max_comparator_props { typedef std::less< typename FloatTraits::value_type > comparator; static const int multiplier = -1; }; template < typename FloatTraits, typename ComparatorProps > struct float_wrapper { typedef typename FloatTraits::value_type value_type; typedef ComparatorProps comparator_props_t; typedef typename ComparatorProps::comparator comparator; static value_type infinity() { return FloatTraits::infinity() * ComparatorProps::multiplier; } static value_type epsilon() { return FloatTraits::epsilon() * ComparatorProps::multiplier; } }; /*! @class mcr_howard * @brief Calculates optimum (maximum/minimum) cycle ratio of a directed * graph. Uses Howard's iteration policy algorithm.
(It is described * in the paper "Experimental Analysis of the Fastest Optimum Cycle Ratio * and Mean Algorithm" by Ali Dasdan). */ template < typename FloatTraits, typename Graph, typename VertexIndexMap, typename EdgeWeight1, typename EdgeWeight2 > class mcr_howard { public: typedef typename FloatTraits::value_type float_t; typedef typename FloatTraits::comparator_props_t cmp_props_t; typedef typename FloatTraits::comparator comparator_t; typedef enum { my_white = 0, my_black } my_color_type; typedef typename graph_traits< Graph >::vertex_descriptor vertex_t; typedef typename graph_traits< Graph >::edge_descriptor edge_t; typedef typename graph_traits< Graph >::vertices_size_type vn_t; typedef std::vector< float_t > vp_t; typedef typename boost::iterator_property_map< typename vp_t::iterator, VertexIndexMap > distance_map_t; // V -> float_t typedef typename std::vector< edge_t > ve_t; typedef std::vector< my_color_type > vcol_t; typedef typename ::boost::iterator_property_map< typename ve_t::iterator, VertexIndexMap > policy_t; // Vertex -> Edge typedef typename ::boost::iterator_property_map< typename vcol_t::iterator, VertexIndexMap > color_map_t; typedef typename std::list< vertex_t > pinel_t; // The in_edges list of the policy graph typedef typename std::vector< pinel_t > inedges1_t; typedef typename ::boost::iterator_property_map< typename inedges1_t::iterator, VertexIndexMap > inedges_t; typedef typename std::vector< edge_t > critical_cycle_t; // Bad vertex flag. If true, then the vertex is "bad". // Vertex is "bad" if its out_degree is equal to zero. typedef typename boost::iterator_property_map< std::vector< int >::iterator, VertexIndexMap > badv_t; /*! * Constructor * \param g = (V, E) - a directed multigraph. * \param vim Vertex Index Map. Read property Map: V -> [0, * num_vertices(g)). \param ewm edge weight map. Read property map: E * -> R \param ew2m edge weight map. Read property map: E -> R+ \param * infty A big enough value to guaranty that there exist a cycle with * better ratio. * \param cmp The compare operator for float_ts. */ mcr_howard(const Graph& g, VertexIndexMap vim, EdgeWeight1 ewm, EdgeWeight2 ew2m) : m_g(g) , m_vim(vim) , m_ew1m(ewm) , m_ew2m(ew2m) , m_bound(mcr_bound()) , m_cr(m_bound) , m_V(num_vertices(m_g)) , m_dis(m_V, 0) , m_dm(m_dis.begin(), m_vim) , m_policyc(m_V) , m_policy(m_policyc.begin(), m_vim) , m_inelc(m_V) , m_inel(m_inelc.begin(), m_vim) , m_badvc(m_V, false) , m_badv(m_badvc.begin(), m_vim) , m_colcv(m_V) , m_col_bfs(m_V) { } /*! * \return maximum/minimum_{for all cycles C} * [sum_{e in C} w1(e)] / [sum_{e in C} w2(e)], * or FloatTraits::infinity() if graph has no cycles. */ float_t ocr_howard() { construct_policy_graph(); int k = 0; float_t mcr = 0; do { mcr = policy_mcr(); ++k; } while ( try_improve_policy(mcr) && k < 100); // To avoid infinite loop const float_t eps_ = -0.00000001 * cmp_props_t::multiplier; if (m_cmp(mcr, m_bound + eps_)) { return FloatTraits::infinity(); } else { return mcr; } } virtual ~mcr_howard() {} protected: virtual void store_critical_edge(edge_t, critical_cycle_t&) {} virtual void store_critical_cycle(critical_cycle_t&) {} private: /*! * \return lower/upper bound for the maximal/minimal cycle ratio */ float_t mcr_bound() { typename graph_traits< Graph >::vertex_iterator vi, vie; typename graph_traits< Graph >::out_edge_iterator oei, oeie; float_t cz = (std::numeric_limits< float_t >::max)(); // Closest to // zero value float_t s = 0; const float_t eps_ = std::numeric_limits< float_t >::epsilon(); for (boost::tie(vi, vie) = vertices(m_g); vi != vie; ++vi) { for (boost::tie(oei, oeie) = out_edges(*vi, m_g); oei != oeie; ++oei) { s += std::abs(m_ew1m[*oei]); float_t a = std::abs(m_ew2m[*oei]); if (a > eps_ && a < cz) { cz = a; } } } return cmp_props_t::multiplier * (s / cz); } /*! * Constructs an arbitrary policy graph. */ void construct_policy_graph() { m_sink = graph_traits< Graph >().null_vertex(); typename graph_traits< Graph >::vertex_iterator vi, vie; typename graph_traits< Graph >::out_edge_iterator oei, oeie; for (boost::tie(vi, vie) = vertices(m_g); vi != vie; ++vi) { using namespace boost::placeholders; boost::tie(oei, oeie) = out_edges(*vi, m_g); typename graph_traits< Graph >::out_edge_iterator mei = std::max_element(oei, oeie, boost::bind(m_cmp, boost::bind(&EdgeWeight1::operator[], m_ew1m, _1), boost::bind(&EdgeWeight1::operator[], m_ew1m, _2))); if (mei == oeie) { if (m_sink == graph_traits< Graph >().null_vertex()) { m_sink = *vi; } m_badv[*vi] = true; m_inel[m_sink].push_back(*vi); } else { m_inel[target(*mei, m_g)].push_back(*vi); m_policy[*vi] = *mei; } } } /*! Sets the distance value for all vertices "v" such that there is * a path from "v" to "sv". It does "inverse" breadth first visit of the * policy graph, starting from the vertex "sv". */ void mcr_bfv(vertex_t sv, float_t cr, color_map_t c) { boost::queue< vertex_t > Q; c[sv] = my_black; Q.push(sv); while (!Q.empty()) { vertex_t v = Q.top(); Q.pop(); for (typename pinel_t::const_iterator itr = m_inel[v].begin(); itr != m_inel[v].end(); ++itr) // For all in_edges of the policy graph { if (*itr != sv) { if (m_badv[*itr]) { m_dm[*itr] = m_dm[v] + m_bound - cr; } else { m_dm[*itr] = m_dm[v] + m_ew1m[m_policy[*itr]] - m_ew2m[m_policy[*itr]] * cr; } c[*itr] = my_black; Q.push(*itr); } } } } /*! * \param sv an arbitrary (undiscovered) vertex of the policy graph. * \return a vertex in the policy graph that belongs to a cycle. * Performs a depth first visit until a cycle edge is found. */ vertex_t find_cycle_vertex(vertex_t sv) { vertex_t gv = sv; std::fill(m_colcv.begin(), m_colcv.end(), my_white); color_map_t cm(m_colcv.begin(), m_vim); do { cm[gv] = my_black; if (!m_badv[gv]) { gv = target(m_policy[gv], m_g); } else { gv = m_sink; } } while (cm[gv] != my_black); return gv; } /*! * \param sv - vertex that belongs to a cycle in the policy graph. */ float_t cycle_ratio(vertex_t sv) { if (sv == m_sink) return m_bound; std::pair< float_t, float_t > sums_(float_t(0), float_t(0)); vertex_t v = sv; critical_cycle_t cc; do { store_critical_edge(m_policy[v], cc); sums_.first += m_ew1m[m_policy[v]]; sums_.second += m_ew2m[m_policy[v]]; v = target(m_policy[v], m_g); } while (v != sv); float_t cr = sums_.first / sums_.second; if (m_cmp(m_cr, cr)) { m_cr = cr; store_critical_cycle(cc); } return cr; } /*! * Finds the optimal cycle ratio of the policy graph */ float_t policy_mcr() { using namespace boost::placeholders; std::fill(m_col_bfs.begin(), m_col_bfs.end(), my_white); color_map_t vcm_ = color_map_t(m_col_bfs.begin(), m_vim); typename graph_traits< Graph >::vertex_iterator uv_itr, vie; boost::tie(uv_itr, vie) = vertices(m_g); float_t mcr = m_bound; while ((uv_itr = std::find_if(uv_itr, vie, boost::bind(std::equal_to< my_color_type >(), my_white, boost::bind(&color_map_t::operator[], vcm_, _1)))) != vie) /// While there are undiscovered vertices { vertex_t gv = find_cycle_vertex(*uv_itr); float_t cr = cycle_ratio(gv); mcr_bfv(gv, cr, vcm_); if (m_cmp(mcr, cr)) mcr = cr; ++uv_itr; } return mcr; } /*! * Changes the edge m_policy[s] to the new_edge. */ void improve_policy(vertex_t s, edge_t new_edge) { vertex_t t = target(m_policy[s], m_g); typename property_traits< VertexIndexMap >::value_type ti = m_vim[t]; m_inelc[ti].erase( std::find(m_inelc[ti].begin(), m_inelc[ti].end(), s)); m_policy[s] = new_edge; t = target(new_edge, m_g); m_inel[t].push_back(s); /// Maintain in_edge list } /*! * A negative cycle detector. */ bool try_improve_policy(float_t cr) { bool improved = false; typename graph_traits< Graph >::vertex_iterator vi, vie; typename graph_traits< Graph >::out_edge_iterator oei, oeie; const float_t eps_ = FloatTraits::epsilon(); for (boost::tie(vi, vie) = vertices(m_g); vi != vie; ++vi) { if (!m_badv[*vi]) { for (boost::tie(oei, oeie) = out_edges(*vi, m_g); oei != oeie; ++oei) { vertex_t t = target(*oei, m_g); // Current distance from *vi to some vertex float_t dis_ = m_ew1m[*oei] - m_ew2m[*oei] * cr + m_dm[t]; if (m_cmp(m_dm[*vi] + eps_, dis_)) { improve_policy(*vi, *oei); m_dm[*vi] = dis_; improved = true; } } } else { float_t dis_ = m_bound - cr + m_dm[m_sink]; if (m_cmp(m_dm[*vi] + eps_, dis_)) { m_dm[*vi] = dis_; } } } return improved; } private: const Graph& m_g; VertexIndexMap m_vim; EdgeWeight1 m_ew1m; EdgeWeight2 m_ew2m; comparator_t m_cmp; float_t m_bound; //> The lower/upper bound to the maximal/minimal cycle // ratio float_t m_cr; //>The best cycle ratio that has been found so far vn_t m_V; //>The number of the vertices in the graph vp_t m_dis; //>Container for the distance map distance_map_t m_dm; //>Distance map ve_t m_policyc; //>Container for the policy graph policy_t m_policy; //>The interface for the policy graph inedges1_t m_inelc; //>Container fot in edges list inedges_t m_inel; //>Policy graph, input edges list std::vector< int > m_badvc; badv_t m_badv; // Marks "bad" vertices vcol_t m_colcv, m_col_bfs; // Color maps vertex_t m_sink; // To convert any graph to "good" }; /*! \class mcr_howard1 * \brief Finds optimum cycle raio and a critical cycle */ template < typename FloatTraits, typename Graph, typename VertexIndexMap, typename EdgeWeight1, typename EdgeWeight2 > class mcr_howard1 : public mcr_howard< FloatTraits, Graph, VertexIndexMap, EdgeWeight1, EdgeWeight2 > { public: typedef mcr_howard< FloatTraits, Graph, VertexIndexMap, EdgeWeight1, EdgeWeight2 > inhr_t; mcr_howard1(const Graph& g, VertexIndexMap vim, EdgeWeight1 ewm, EdgeWeight2 ew2m) : inhr_t(g, vim, ewm, ew2m) { } void get_critical_cycle(typename inhr_t::critical_cycle_t& cc) { return cc.swap(m_cc); } protected: void store_critical_edge( typename inhr_t::edge_t ed, typename inhr_t::critical_cycle_t& cc) { cc.push_back(ed); } void store_critical_cycle(typename inhr_t::critical_cycle_t& cc) { m_cc.swap(cc); } private: typename inhr_t::critical_cycle_t m_cc; // Critical cycle }; /*! * \param g a directed multigraph. * \param vim Vertex Index Map. A map V->[0, num_vertices(g)) * \param ewm Edge weight1 map. * \param ew2m Edge weight2 map. * \param pcc pointer to the critical edges list. * \return Optimum cycle ratio of g or FloatTraits::infinity() if g has no * cycles. */ template < typename FT, typename TG, typename TVIM, typename TEW1, typename TEW2, typename EV > typename FT::value_type optimum_cycle_ratio( const TG& g, TVIM vim, TEW1 ewm, TEW2 ew2m, EV* pcc) { typedef typename graph_traits< TG >::directed_category DirCat; BOOST_STATIC_ASSERT( (is_convertible< DirCat*, directed_tag* >::value == true)); BOOST_CONCEPT_ASSERT((IncidenceGraphConcept< TG >)); BOOST_CONCEPT_ASSERT((VertexListGraphConcept< TG >)); typedef typename graph_traits< TG >::vertex_descriptor Vertex; BOOST_CONCEPT_ASSERT((ReadablePropertyMapConcept< TVIM, Vertex >)); typedef typename graph_traits< TG >::edge_descriptor Edge; BOOST_CONCEPT_ASSERT((ReadablePropertyMapConcept< TEW1, Edge >)); BOOST_CONCEPT_ASSERT((ReadablePropertyMapConcept< TEW2, Edge >)); if (pcc == 0) { return detail::mcr_howard< FT, TG, TVIM, TEW1, TEW2 >( g, vim, ewm, ew2m) .ocr_howard(); } detail::mcr_howard1< FT, TG, TVIM, TEW1, TEW2 > obj(g, vim, ewm, ew2m); double ocr = obj.ocr_howard(); obj.get_critical_cycle(*pcc); return ocr; } } // namespace detail // Algorithms // Maximum Cycle Ratio template < typename FloatTraits, typename Graph, typename VertexIndexMap, typename EdgeWeight1Map, typename EdgeWeight2Map > inline typename FloatTraits::value_type maximum_cycle_ratio(const Graph& g, VertexIndexMap vim, EdgeWeight1Map ew1m, EdgeWeight2Map ew2m, std::vector< typename graph_traits< Graph >::edge_descriptor >* pcc = 0, FloatTraits = FloatTraits()) { typedef detail::float_wrapper< FloatTraits, detail::max_comparator_props< FloatTraits > > Traits; return detail::optimum_cycle_ratio< Traits >(g, vim, ew1m, ew2m, pcc); } template < typename Graph, typename VertexIndexMap, typename EdgeWeight1Map, typename EdgeWeight2Map > inline double maximum_cycle_ratio(const Graph& g, VertexIndexMap vim, EdgeWeight1Map ew1m, EdgeWeight2Map ew2m, std::vector< typename graph_traits< Graph >::edge_descriptor >* pcc = 0) { return maximum_cycle_ratio(g, vim, ew1m, ew2m, pcc, mcr_float<>()); } // Minimum Cycle Ratio template < typename FloatTraits, typename Graph, typename VertexIndexMap, typename EdgeWeight1Map, typename EdgeWeight2Map > typename FloatTraits::value_type minimum_cycle_ratio(const Graph& g, VertexIndexMap vim, EdgeWeight1Map ew1m, EdgeWeight2Map ew2m, std::vector< typename graph_traits< Graph >::edge_descriptor >* pcc = 0, FloatTraits = FloatTraits()) { typedef detail::float_wrapper< FloatTraits, detail::min_comparator_props< FloatTraits > > Traits; return detail::optimum_cycle_ratio< Traits >(g, vim, ew1m, ew2m, pcc); } template < typename Graph, typename VertexIndexMap, typename EdgeWeight1Map, typename EdgeWeight2Map > inline double minimum_cycle_ratio(const Graph& g, VertexIndexMap vim, EdgeWeight1Map ew1m, EdgeWeight2Map ew2m, std::vector< typename graph_traits< Graph >::edge_descriptor >* pcc = 0) { return minimum_cycle_ratio(g, vim, ew1m, ew2m, pcc, mcr_float<>()); } // Maximum Cycle Mean template < typename FloatTraits, typename Graph, typename VertexIndexMap, typename EdgeWeightMap, typename EdgeIndexMap > inline typename FloatTraits::value_type maximum_cycle_mean(const Graph& g, VertexIndexMap vim, EdgeWeightMap ewm, EdgeIndexMap eim, std::vector< typename graph_traits< Graph >::edge_descriptor >* pcc = 0, FloatTraits ft = FloatTraits()) { typedef typename remove_const< typename property_traits< EdgeWeightMap >::value_type >::type Weight; typename std::vector< Weight > ed_w2(boost::num_edges(g), 1); return maximum_cycle_ratio( g, vim, ewm, make_iterator_property_map(ed_w2.begin(), eim), pcc, ft); } template < typename Graph, typename VertexIndexMap, typename EdgeWeightMap, typename EdgeIndexMap > inline double maximum_cycle_mean(const Graph& g, VertexIndexMap vim, EdgeWeightMap ewm, EdgeIndexMap eim, std::vector< typename graph_traits< Graph >::edge_descriptor >* pcc = 0) { return maximum_cycle_mean(g, vim, ewm, eim, pcc, mcr_float<>()); } // Minimum Cycle Mean template < typename FloatTraits, typename Graph, typename VertexIndexMap, typename EdgeWeightMap, typename EdgeIndexMap > inline typename FloatTraits::value_type minimum_cycle_mean(const Graph& g, VertexIndexMap vim, EdgeWeightMap ewm, EdgeIndexMap eim, std::vector< typename graph_traits< Graph >::edge_descriptor >* pcc = 0, FloatTraits ft = FloatTraits()) { typedef typename remove_const< typename property_traits< EdgeWeightMap >::value_type >::type Weight; typename std::vector< Weight > ed_w2(boost::num_edges(g), 1); return minimum_cycle_ratio( g, vim, ewm, make_iterator_property_map(ed_w2.begin(), eim), pcc, ft); } template < typename Graph, typename VertexIndexMap, typename EdgeWeightMap, typename EdgeIndexMap > inline double minimum_cycle_mean(const Graph& g, VertexIndexMap vim, EdgeWeightMap ewm, EdgeIndexMap eim, std::vector< typename graph_traits< Graph >::edge_descriptor >* pcc = 0) { return minimum_cycle_mean(g, vim, ewm, eim, pcc, mcr_float<>()); } } // namespace boost #endif