diff --git a/doc/prim_minimum_spanning_tree.html b/doc/prim_minimum_spanning_tree.html index 324f4196..cf373c70 100644 --- a/doc/prim_minimum_spanning_tree.html +++ b/doc/prim_minimum_spanning_tree.html @@ -172,7 +172,9 @@ IN: weight_map(WeightMap w_map) Readable Property Map. The edge descriptor type of the graph needs to be usable as the key type for the weight map. The value type for the map must be - Addable with the value type of the distance map.
+ the same as the value type of the distance map, and that type must be Less Than + Comparable.
Default: get(edge_weight, g)
Python: Must be an edge_double_map for the graph.
Python default: graph.get_edge_double_map("weight") @@ -190,7 +192,7 @@ IN: vertex_index_map(VertexIndexMap i_map) Default: get(vertex_index, g) Note: if you use this default, make sure your graph has an internal vertex_index property. For example, - adjacenty_list with VertexList=listS does + adjacency_list with VertexList=listS does not have an internal vertex_index property.
Python: Unsupported parameter. @@ -204,10 +206,9 @@ UTIL/OUT: distance_map(DistanceMap d_map) The type DistanceMap must be a model of Read/Write Property Map. The vertex descriptor type of the - graph needs to be usable as the key type of the distance map. The - value type of the distance map must be Less Than - Comparable.
+ graph needs to be usable as the key type of the distance map, and the value + type needs to be the same as the value type of the weight_map + argument.
Default: iterator_property_map created from a std::vector of the WeightMap's value type of size diff --git a/example/Jamfile.v2 b/example/Jamfile.v2 index fa7ebf9d..62ae5c25 100644 --- a/example/Jamfile.v2 +++ b/example/Jamfile.v2 @@ -33,3 +33,6 @@ exe stoer_wagner : stoer_wagner.cpp ; exe bfs-example : bfs-example.cpp ; exe bfs-example2 : bfs-example2.cpp ; exe dfs-example : dfs-example.cpp ; +exe adjacency_list_io : adjacency_list_io.cpp ; +exe strong_components : strong_components.cpp ../build//boost_graph ; +exe strong-components : strong-components.cpp ; diff --git a/example/astar_maze.cpp b/example/astar_maze.cpp index 20cff4fd..840bce54 100644 --- a/example/astar_maze.cpp +++ b/example/astar_maze.cpp @@ -221,7 +221,7 @@ std::ostream& operator<<(std::ostream& output, const maze& m) { if (x == 0) output << BARRIER; // Put the character representing this point in the maze grid. - vertex_descriptor u = {{x, y}}; + vertex_descriptor u = {{x, vertices_size_type(y)}}; if (m.solution_contains(u)) output << "."; else if (m.has_barrier(u)) diff --git a/example/strong_components.cpp b/example/strong_components.cpp index 4b01f886..089e3ef9 100644 --- a/example/strong_components.cpp +++ b/example/strong_components.cpp @@ -46,22 +46,23 @@ int main(int, char*[]) using namespace boost; const char* name = "abcdefghij"; - GraphvizDigraph G; - read_graphviz("scc.dot", G); + adjacency_list G; + dynamic_properties dp; + read_graphviz("scc.dot", G, dp); std::cout << "A directed graph:" << std::endl; print_graph(G, name); std::cout << std::endl; - typedef graph_traits::vertex_descriptor Vertex; + typedef graph_traits >::vertex_descriptor Vertex; std::vector component(num_vertices(G)), discover_time(num_vertices(G)); std::vector color(num_vertices(G)); std::vector root(num_vertices(G)); - int num = strong_components(G, &component[0], - root_map(&root[0]). - color_map(&color[0]). - discover_time_map(&discover_time[0])); + int num = strong_components(G, make_iterator_property_map(component.begin(), get(vertex_index, G)), + root_map(make_iterator_property_map(root.begin(), get(vertex_index, G))). + color_map(make_iterator_property_map(color.begin(), get(vertex_index, G))). + discover_time_map(make_iterator_property_map(discover_time.begin(), get(vertex_index, G)))); std::cout << "Total number of components: " << num << std::endl; std::vector::size_type i; diff --git a/include/boost/graph/adjacency_list.hpp b/include/boost/graph/adjacency_list.hpp index 5034fec5..a260a0f1 100644 --- a/include/boost/graph/adjacency_list.hpp +++ b/include/boost/graph/adjacency_list.hpp @@ -502,20 +502,20 @@ namespace boost { #define ADJLIST adjacency_list template - inline void set_property(ADJLIST& g, Tag, Value const& value) { - get_property_value(*g.m_property, Tag()) = value; + inline void set_property(ADJLIST& g, Tag tag, Value const& value) { + get_property_value(*g.m_property, tag) = value; } template inline typename graph_property::type& - get_property(ADJLIST& g, Tag) { - return get_property_value(*g.m_property, Tag()); + get_property(ADJLIST& g, Tag tag) { + return get_property_value(*g.m_property, tag); } template inline typename graph_property::type const& - get_property(ADJLIST const& g, Tag) { - return get_property_value(*g.m_property, Tag()); + get_property(ADJLIST const& g, Tag tag) { + return get_property_value(*g.m_property, tag); } // dwa 09/25/00 - needed to be more explicit so reverse_graph would work. diff --git a/include/boost/graph/bron_kerbosch_all_cliques.hpp b/include/boost/graph/bron_kerbosch_all_cliques.hpp index 91960936..b663cf95 100644 --- a/include/boost/graph/bron_kerbosch_all_cliques.hpp +++ b/include/boost/graph/bron_kerbosch_all_cliques.hpp @@ -270,7 +270,6 @@ bron_kerbosch_all_cliques(const Graph& g, Visitor vis, std::size_t min) { BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept )); BOOST_CONCEPT_ASSERT(( VertexListGraphConcept )); - BOOST_CONCEPT_ASSERT(( VertexIndexGraphConcept )); BOOST_CONCEPT_ASSERT(( AdjacencyMatrixConcept )); // Structural requirement only typedef typename graph_traits::vertex_descriptor Vertex; typedef typename graph_traits::vertex_iterator VertexIterator; diff --git a/include/boost/graph/chrobak_payne_drawing.hpp b/include/boost/graph/chrobak_payne_drawing.hpp index ef6ae5c9..4d026986 100644 --- a/include/boost/graph/chrobak_payne_drawing.hpp +++ b/include/boost/graph/chrobak_payne_drawing.hpp @@ -13,7 +13,6 @@ #include #include #include -#include //for next and prior #include #include diff --git a/include/boost/graph/clustering_coefficient.hpp b/include/boost/graph/clustering_coefficient.hpp index dad4695a..5345ed99 100644 --- a/include/boost/graph/clustering_coefficient.hpp +++ b/include/boost/graph/clustering_coefficient.hpp @@ -7,7 +7,7 @@ #ifndef BOOST_GRAPH_CLUSTERING_COEFFICIENT_HPP #define BOOST_GRAPH_CLUSTERING_COEFFICIENT_HPP -#include +#include #include #include #include diff --git a/include/boost/graph/compressed_sparse_row_graph.hpp b/include/boost/graph/compressed_sparse_row_graph.hpp index 75e61659..c13ae8e8 100644 --- a/include/boost/graph/compressed_sparse_row_graph.hpp +++ b/include/boost/graph/compressed_sparse_row_graph.hpp @@ -41,7 +41,7 @@ #include #include #include -#include +#include #ifdef BOOST_GRAPH_NO_BUNDLED_PROPERTIES # error The Compressed Sparse Row graph only supports bundled properties. @@ -1382,26 +1382,26 @@ edges(const BOOST_CSR_GRAPH_TYPE& g) // Graph properties template inline void -set_property(BOOST_CSR_GRAPH_TYPE& g, Tag, const Value& value) +set_property(BOOST_CSR_GRAPH_TYPE& g, Tag tag, const Value& value) { - get_property_value(g.m_property, Tag()) = value; + get_property_value(g.m_property, tag) = value; } template inline typename graph_property::type& -get_property(BOOST_CSR_GRAPH_TYPE& g, Tag) +get_property(BOOST_CSR_GRAPH_TYPE& g, Tag tag) { - return get_property_value(g.m_property, Tag()); + return get_property_value(g.m_property, tag); } template inline const typename graph_property::type& -get_property(const BOOST_CSR_GRAPH_TYPE& g, Tag) +get_property(const BOOST_CSR_GRAPH_TYPE& g, Tag tag) { - return get_property_value(g.m_property, Tag()); + return get_property_value(g.m_property, tag); } template diff --git a/include/boost/graph/detail/adjacency_list.hpp b/include/boost/graph/detail/adjacency_list.hpp index 100c44ba..b3e4115f 100644 --- a/include/boost/graph/detail/adjacency_list.hpp +++ b/include/boost/graph/detail/adjacency_list.hpp @@ -727,8 +727,10 @@ namespace boost { typename Config::OutEdgeList& out_el = g.out_edge_list(source(e, g)); typename Config::OutEdgeList::iterator out_i = out_el.begin(); + typename Config::EdgeIter edge_iter_to_erase; for (; out_i != out_el.end(); ++out_i) if (&(*out_i).get_property() == &p) { + edge_iter_to_erase = (*out_i).get_iter(); out_el.erase(out_i); break; } @@ -736,10 +738,10 @@ namespace boost { typename Config::OutEdgeList::iterator in_i = in_el.begin(); for (; in_i != in_el.end(); ++in_i) if (&(*in_i).get_property() == &p) { - g.m_edges.erase((*in_i).get_iter()); in_el.erase(in_i); - return; + break; } + g.m_edges.erase(edge_iter_to_erase); } }; @@ -760,8 +762,10 @@ namespace boost { no_property* p = (no_property*)e.get_property(); typename Config::OutEdgeList& out_el = g.out_edge_list(source(e, g)); typename Config::OutEdgeList::iterator out_i = out_el.begin(); + typename Config::EdgeIter edge_iter_to_erase; for (; out_i != out_el.end(); ++out_i) if (&(*out_i).get_property() == p) { + edge_iter_to_erase = (*out_i).get_iter(); out_el.erase(out_i); break; } @@ -769,10 +773,10 @@ namespace boost { typename Config::OutEdgeList::iterator in_i = in_el.begin(); for (; in_i != in_el.end(); ++in_i) if (&(*in_i).get_property() == p) { - g.m_edges.erase((*in_i).get_iter()); in_el.erase(in_i); - return; + break; } + g.m_edges.erase(edge_iter_to_erase); } }; @@ -811,6 +815,7 @@ namespace boost { typedef typename EdgeList::value_type StoredEdge; typename EdgeList::iterator i = el.find(StoredEdge(v)), end = el.end(); + BOOST_ASSERT ((i != end)); if (i != end) { g.m_edges.erase((*i).get_iter()); el.erase(i); @@ -991,24 +996,12 @@ namespace boost { typedef typename Config::graph_type graph_type; typedef typename Config::edge_parallel_category Cat; graph_type& g = static_cast(g_); - typename Config::OutEdgeList& el = g.out_edge_list(u); - typename Config::OutEdgeList::iterator - ei = el.begin(), ei_end = el.end(); - for (; ei != ei_end; /* Increment below */ ) { - bool is_self_loop = (*ei).get_target() == u; - // Don't erase from our own incidence list in the case of a self-loop - // since we're clearing it anyway. - if (!is_self_loop) { - detail::erase_from_incidence_list - (g.out_edge_list((*ei).get_target()), u, Cat()); - typename Config::OutEdgeList::iterator ei_copy = ei; - ++ei; - if (!is_self_loop) g.m_edges.erase((*ei_copy).get_iter()); - } else { - ++ei; - } + while (true) { + typename Config::out_edge_iterator ei, ei_end; + boost::tie(ei, ei_end) = out_edges(u, g); + if (ei == ei_end) break; + remove_edge(*ei, g); } - g.out_edge_list(u).clear(); } // O(1) for allow_parallel_edge_tag // O(log(E/V)) for disallow_parallel_edge_tag diff --git a/include/boost/graph/detail/compressed_sparse_row_struct.hpp b/include/boost/graph/detail/compressed_sparse_row_struct.hpp index 75ac9620..56495f34 100644 --- a/include/boost/graph/detail/compressed_sparse_row_struct.hpp +++ b/include/boost/graph/detail/compressed_sparse_row_struct.hpp @@ -44,7 +44,6 @@ #include #include #include -#include namespace boost { diff --git a/include/boost/graph/directed_graph.hpp b/include/boost/graph/directed_graph.hpp index 0bf02519..f5b65022 100644 --- a/include/boost/graph/directed_graph.hpp +++ b/include/boost/graph/directed_graph.hpp @@ -7,7 +7,6 @@ #ifndef BOOST_GRAPH_DIRECTED_GRAPH_HPP #define BOOST_GRAPH_DIRECTED_GRAPH_HPP -#include #include #include diff --git a/include/boost/graph/eccentricity.hpp b/include/boost/graph/eccentricity.hpp index a8b3e485..63797a83 100644 --- a/include/boost/graph/eccentricity.hpp +++ b/include/boost/graph/eccentricity.hpp @@ -7,7 +7,7 @@ #ifndef BOOST_GRAPH_ECCENTRICITY_HPP #define BOOST_GRAPH_ECCENTRICITY_HPP -#include +#include #include #include #include diff --git a/include/boost/graph/graph_archetypes.hpp b/include/boost/graph/graph_archetypes.hpp index 9b364bb8..81f9c2c8 100644 --- a/include/boost/graph/graph_archetypes.hpp +++ b/include/boost/graph/graph_archetypes.hpp @@ -53,6 +53,8 @@ namespace boost { // should use a different namespace for this typedef void in_edge_iterator; typedef void vertex_iterator; typedef void edge_iterator; + + static vertex_descriptor null_vertex() {return vertex_descriptor();} }; template V source(const typename incidence_graph_archetype::edge_descriptor&, @@ -105,6 +107,8 @@ namespace boost { // should use a different namespace for this typedef void out_edge_iterator; typedef void vertex_iterator; typedef void edge_iterator; + + static vertex_descriptor null_vertex() {return vertex_descriptor();} }; template @@ -154,6 +158,8 @@ namespace boost { // should use a different namespace for this typedef void in_edge_iterator; typedef void edge_iterator; + + static vertex_descriptor null_vertex() {return vertex_descriptor();} }; template diff --git a/include/boost/graph/graph_test.hpp b/include/boost/graph/graph_test.hpp index 7b3a5402..69d89f34 100644 --- a/include/boost/graph/graph_test.hpp +++ b/include/boost/graph/graph_test.hpp @@ -325,10 +325,10 @@ namespace boost { template void test_readable_vertex_property_graph - (const std::vector& vertex_prop, PropertyTag, const Graph& g) + (const std::vector& vertex_prop, PropertyTag tag, const Graph& g) { typedef typename property_map::const_type const_Map; - const_Map pmap = get(PropertyTag(), g); + const_Map pmap = get(tag, g); typename std::vector::const_iterator i = vertex_prop.begin(); for (typename boost::graph_traits::vertex_iterator @@ -339,7 +339,7 @@ namespace boost { ++bgl_first_9) { //BGL_FORALL_VERTICES_T(v, g, Graph) { typename property_traits::value_type - pval1 = get(pmap, v), pval2 = get(PropertyTag(), g, v); + pval1 = get(pmap, v), pval2 = get(tag, g, v); BOOST_CHECK(pval1 == pval2); BOOST_CHECK(pval1 == *i++); } @@ -350,7 +350,7 @@ namespace boost { (const std::vector& vertex_prop, PropertyTag tag, Graph& g) { typedef typename property_map::type PMap; - PMap pmap = get(PropertyTag(), g); + PMap pmap = get(tag, g); typename std::vector::const_iterator i = vertex_prop.begin(); for (typename boost::graph_traits::vertex_iterator bgl_first_9 = vertices(g).first, bgl_last_9 = vertices(g).second; @@ -368,7 +368,7 @@ namespace boost { typename std::vector::const_iterator j = vertex_prop.begin(); BGL_FORALL_VERTICES_T(v, g, Graph) - put(PropertyTag(), g, v, *j++); + put(tag, g, v, *j++); test_readable_vertex_property_graph(vertex_prop, tag, g); } diff --git a/include/boost/graph/graphviz.hpp b/include/boost/graph/graphviz.hpp index 718220ff..54619c92 100644 --- a/include/boost/graph/graphviz.hpp +++ b/include/boost/graph/graphviz.hpp @@ -29,6 +29,7 @@ #include #include #include +#include namespace boost { diff --git a/include/boost/graph/is_kuratowski_subgraph.hpp b/include/boost/graph/is_kuratowski_subgraph.hpp index 8791b4cf..1dd314d3 100644 --- a/include/boost/graph/is_kuratowski_subgraph.hpp +++ b/include/boost/graph/is_kuratowski_subgraph.hpp @@ -9,7 +9,6 @@ #define __IS_KURATOWSKI_SUBGRAPH_HPP__ #include -#include //for next/prior #include //for tie #include #include @@ -301,11 +300,11 @@ namespace boost if (target_graph == detail::tg_k_5) { - return isomorphism(K_5,contracted_graph); + return boost::isomorphism(K_5,contracted_graph); } else //target_graph == tg_k_3_3 { - return isomorphism(K_3_3,contracted_graph); + return boost::isomorphism(K_3_3,contracted_graph); } diff --git a/include/boost/graph/is_straight_line_drawing.hpp b/include/boost/graph/is_straight_line_drawing.hpp index 161da4d1..c471cde8 100644 --- a/include/boost/graph/is_straight_line_drawing.hpp +++ b/include/boost/graph/is_straight_line_drawing.hpp @@ -9,7 +9,7 @@ #define __IS_STRAIGHT_LINE_DRAWING_HPP__ #include -#include //for next and prior +#include #include #include #include diff --git a/include/boost/graph/isomorphism.hpp b/include/boost/graph/isomorphism.hpp index f8e44867..c2b6d8ea 100644 --- a/include/boost/graph/isomorphism.hpp +++ b/include/boost/graph/isomorphism.hpp @@ -11,9 +11,9 @@ #include #include #include +#include #include #include -#include #include #include // for make_indirect_pmap #include @@ -135,6 +135,10 @@ namespace boost { bool test_isomorphism() { + // reset isomapping + BGL_FORALL_VERTICES_T(v, G1, Graph1) + f[v] = graph_traits::null_vertex(); + { std::vector invar1_array; BGL_FORALL_VERTICES_T(v, G1, Graph1) @@ -309,7 +313,14 @@ fi_adj_loop_k:++fi_adj.first; case match_continuation::pos_G2_vertex_loop: {G2_verts = this_k.G2_verts; iter = this_k.iter; dfs_num_k = this_k.dfs_num_k; k.pop_back(); in_S[*G2_verts.first] = false; i = source(*iter, G1); j = target(*iter, G2); goto G2_loop_k;} case match_continuation::pos_fi_adj_loop: {fi_adj = this_k.fi_adj; iter = this_k.iter; dfs_num_k = this_k.dfs_num_k; k.pop_back(); in_S[*fi_adj.first] = false; i = source(*iter, G1); j = target(*iter, G2); goto fi_adj_loop_k;} case match_continuation::pos_dfs_num: {k.pop_back(); goto return_point_false;} - default: assert (!"Bad position"); abort(); + default: { + BOOST_ASSERT(!"Bad position"); +#ifdef UNDER_CE + exit(-1); +#else + abort(); +#endif + } } } } diff --git a/include/boost/graph/make_connected.hpp b/include/boost/graph/make_connected.hpp index de6c861d..a2f8b1ee 100644 --- a/include/boost/graph/make_connected.hpp +++ b/include/boost/graph/make_connected.hpp @@ -9,7 +9,7 @@ #define __MAKE_CONNECTED_HPP__ #include -#include //for next +#include #include //for tie #include #include diff --git a/include/boost/graph/matrix_as_graph.hpp b/include/boost/graph/matrix_as_graph.hpp index b39d126a..fb727940 100644 --- a/include/boost/graph/matrix_as_graph.hpp +++ b/include/boost/graph/matrix_as_graph.hpp @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include namespace boost { diff --git a/include/boost/graph/max_cardinality_matching.hpp b/include/boost/graph/max_cardinality_matching.hpp index 043f7014..5516bebc 100644 --- a/include/boost/graph/max_cardinality_matching.hpp +++ b/include/boost/graph/max_cardinality_matching.hpp @@ -16,7 +16,6 @@ #include // for std::sort and std::stable_sort #include // for std::pair #include -#include // for boost::tie #include #include #include diff --git a/include/boost/graph/named_function_params.hpp b/include/boost/graph/named_function_params.hpp index c5e35fa5..52131b38 100644 --- a/include/boost/graph/named_function_params.hpp +++ b/include/boost/graph/named_function_params.hpp @@ -15,9 +15,8 @@ #include #include #include -#include +#include #include -#include #include #include #include @@ -609,6 +608,13 @@ BOOST_BGL_DECLARE_NAMED_PARAMS make_priority_queue_from_arg_pack_gen(KeyT defaultKey_) : defaultKey(defaultKey_) { } + template + struct result { + typedef typename remove_const::arg1_type>::type>::type graph_type; + typedef typename remove_const::arg2_type>::type>::type arg_pack_type; + typedef typename priority_queue_maker::priority_queue_type type; + }; + template typename priority_queue_maker::priority_queue_type operator()(const Graph& g, const ArgPack& ap) const { diff --git a/include/boost/graph/planar_canonical_ordering.hpp b/include/boost/graph/planar_canonical_ordering.hpp index 6cb7bdb8..86203aaf 100644 --- a/include/boost/graph/planar_canonical_ordering.hpp +++ b/include/boost/graph/planar_canonical_ordering.hpp @@ -12,7 +12,7 @@ #include #include #include -#include //for next and prior +#include #include #include diff --git a/include/boost/graph/planar_detail/boyer_myrvold_impl.hpp b/include/boost/graph/planar_detail/boyer_myrvold_impl.hpp index 71607fcb..41ba2bc5 100644 --- a/include/boost/graph/planar_detail/boyer_myrvold_impl.hpp +++ b/include/boost/graph/planar_detail/boyer_myrvold_impl.hpp @@ -10,7 +10,7 @@ #include #include -#include //for boost::next +#include #include //for std::min macros #include #include diff --git a/include/boost/graph/planar_face_traversal.hpp b/include/boost/graph/planar_face_traversal.hpp index bcd56552..6befa43b 100644 --- a/include/boost/graph/planar_face_traversal.hpp +++ b/include/boost/graph/planar_face_traversal.hpp @@ -10,8 +10,11 @@ #define __PLANAR_FACE_TRAVERSAL_HPP__ #include -#include //for next and prior +#include +#include +#include #include +#include namespace boost diff --git a/include/boost/graph/reverse_graph.hpp b/include/boost/graph/reverse_graph.hpp index 48c4e057..325e0f32 100644 --- a/include/boost/graph/reverse_graph.hpp +++ b/include/boost/graph/reverse_graph.hpp @@ -105,6 +105,7 @@ class reverse_graph { typedef graph_traits Traits; public: typedef BidirectionalGraph base_type; + typedef GraphRef base_ref_type; // Constructor reverse_graph(GraphRef g) : m_g(g) {} @@ -391,14 +392,18 @@ struct edge_property_selector { }; template -typename property_map, Property>::type +typename disable_if< + is_same, + typename property_map, Property>::type>::type get(Property p, reverse_graph& g) { return typename property_map, Property>::type(get(p, g.m_g)); } template -typename property_map, Property>::const_type +typename disable_if< + is_same, + typename property_map, Property>::const_type>::type get(Property p, const reverse_graph& g) { const BidirGraph& gref = g.m_g; // in case GRef is non-const @@ -406,9 +411,11 @@ get(Property p, const reverse_graph& g) } template -typename property_traits< - typename property_map::const_type ->::value_type +typename disable_if< + is_same, + typename property_traits< + typename property_map, Property>::const_type + >::value_type>::type get(Property p, const reverse_graph& g, const Key& k) { return get(get(p, g), k); @@ -459,19 +466,40 @@ struct property_map, edge_underlying_t> { typedef detail::underlying_edge_desc_map_type const_type; }; -template -detail::underlying_edge_desc_map_type::edge_descriptor> +template struct is_reverse_graph: boost::mpl::false_ {}; +template struct is_reverse_graph >: boost::mpl::true_ {}; + +template +typename enable_if, + detail::underlying_edge_desc_map_type::edge_descriptor> >::type get(edge_underlying_t, - const reverse_graph& g) + G& g) { - return detail::underlying_edge_desc_map_type::edge_descriptor>(); + return detail::underlying_edge_desc_map_type::edge_descriptor>(); } -template -typename graph_traits::edge_descriptor +template +typename enable_if, typename graph_traits::edge_descriptor>::type get(edge_underlying_t, - const reverse_graph& g, - const typename graph_traits >::edge_descriptor& k) + G& g, + const typename graph_traits::edge_descriptor& k) +{ + return k.underlying_descx; +} + +template +typename enable_if, detail::underlying_edge_desc_map_type::edge_descriptor> >::type +get(edge_underlying_t, + const G& g) +{ + return detail::underlying_edge_desc_map_type::edge_descriptor>(); +} + +template +typename enable_if, typename graph_traits::edge_descriptor>::type +get(edge_underlying_t, + const G& g, + const typename graph_traits::edge_descriptor& k) { return k.underlying_descx; } diff --git a/include/boost/graph/stanford_graph.hpp b/include/boost/graph/stanford_graph.hpp index 0bb798c0..89f5e34b 100644 --- a/include/boost/graph/stanford_graph.hpp +++ b/include/boost/graph/stanford_graph.hpp @@ -318,13 +318,15 @@ namespace boost { class sgb_vertex_util_map : public boost::put_get_helper > { + Tag tag; public: + explicit sgb_vertex_util_map(Tag tag = Tag()): tag(tag) {} typedef boost::lvalue_property_map_tag category; typedef typename Tag::type value_type; typedef Vertex* key_type; typedef Ref reference; reference operator[](Vertex* v) const { - return get_util_field(v, Tag()); + return get_util_field(v, tag); } }; @@ -333,13 +335,15 @@ namespace boost { class sgb_edge_util_map : public boost::put_get_helper > { + Tag tag; public: + explicit sgb_edge_util_map(Tag tag = Tag()): tag(tag) {} typedef boost::lvalue_property_map_tag category; typedef typename Tag::type value_type; typedef Vertex* key_type; typedef Ref reference; reference operator[](const sgb_edge& e) const { - return get_util_field(e._arc, Tag()); + return get_util_field(e._arc, tag); } }; diff --git a/include/boost/graph/stoer_wagner_min_cut.hpp b/include/boost/graph/stoer_wagner_min_cut.hpp index 814eae0c..060f51b4 100644 --- a/include/boost/graph/stoer_wagner_min_cut.hpp +++ b/include/boost/graph/stoer_wagner_min_cut.hpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include namespace boost { @@ -218,7 +218,9 @@ namespace boost { typedef boost::bgl_named_params params_type; BOOST_GRAPH_DECLARE_CONVERTED_PARAMETERS(params_type, params) - BOOST_AUTO(pq, (boost::detail::make_priority_queue_from_arg_pack_gen >(choose_param(get_param(params, boost::distance_zero_t()), weight_type(0)))(g, arg_pack))); + typedef boost::detail::make_priority_queue_from_arg_pack_gen > gen_type; + gen_type gen(choose_param(get_param(params, boost::distance_zero_t()), weight_type(0))); + typename boost::result_of::type pq = gen(g, arg_pack); return boost::detail::stoer_wagner_min_cut(g, weights, diff --git a/include/boost/graph/subgraph.hpp b/include/boost/graph/subgraph.hpp index 1860c8ce..394c7606 100644 --- a/include/boost/graph/subgraph.hpp +++ b/include/boost/graph/subgraph.hpp @@ -24,7 +24,9 @@ #include #include -#include +#include +#include +#include namespace boost { @@ -778,7 +780,10 @@ class subgraph_global_property_map { typedef property_traits Traits; public: - typedef typename Traits::category category; + typedef typename mpl::if_::type>, + readable_property_map_tag, + typename Traits::category>::type + category; typedef typename Traits::value_type value_type; typedef typename Traits::key_type key_type; typedef typename Traits::reference reference; @@ -813,7 +818,10 @@ class subgraph_local_property_map { typedef property_traits Traits; public: - typedef typename Traits::category category; + typedef typename mpl::if_::type>, + readable_property_map_tag, + typename Traits::category>::type + category; typedef typename Traits::value_type value_type; typedef typename Traits::key_type key_type; typedef typename Traits::reference reference; diff --git a/include/boost/graph/undirected_graph.hpp b/include/boost/graph/undirected_graph.hpp index 3178b42a..9e85b13f 100644 --- a/include/boost/graph/undirected_graph.hpp +++ b/include/boost/graph/undirected_graph.hpp @@ -7,7 +7,6 @@ #ifndef BOOST_GRAPH_UNDIRECTED_GRAPH_HPP #define BOOST_GRAPH_UNDIRECTED_GRAPH_HPP -#include #include #include diff --git a/include/boost/graph/vector_as_graph.hpp b/include/boost/graph/vector_as_graph.hpp index c1799993..7bc8ac38 100644 --- a/include/boost/graph/vector_as_graph.hpp +++ b/include/boost/graph/vector_as_graph.hpp @@ -79,6 +79,7 @@ namespace boost { typedef typename std::vector::size_type vertices_size_type; typedef void edges_size_type; typedef typename EdgeList::size_type degree_size_type; + static V null_vertex() {return V(-1);} }; template struct edge_property_type< std::vector > diff --git a/test/stoer_wagner_test.cpp b/test/stoer_wagner_test.cpp index 112bf495..034d5498 100644 --- a/test/stoer_wagner_test.cpp +++ b/test/stoer_wagner_test.cpp @@ -206,10 +206,12 @@ BOOST_AUTO_TEST_CASE(test_prgen_20_70_2) boost::associative_property_map > components(component); BOOST_CHECK_EQUAL(boost::connected_components(g, components), 1U); // verify the connectedness assumption - BOOST_AUTO(distances, (boost::make_shared_array_property_map(num_vertices(g), weight_type(0), get(boost::vertex_index, g)))); + typedef boost::shared_array_property_map::const_type> distances_type; + distances_type distances = boost::make_shared_array_property_map(num_vertices(g), weight_type(0), get(boost::vertex_index, g)); typedef std::vector::size_type index_in_heap_type; - BOOST_AUTO(indicesInHeap, (boost::make_shared_array_property_map(num_vertices(g), index_in_heap_type(-1), get(boost::vertex_index, g)))); - boost::d_ary_heap_indirect > pq(distances, indicesInHeap); + typedef boost::shared_array_property_map::const_type> indicesInHeap_type; + indicesInHeap_type indicesInHeap = boost::make_shared_array_property_map(num_vertices(g), index_in_heap_type(-1), get(boost::vertex_index, g)); + boost::d_ary_heap_indirect > pq(distances, indicesInHeap); int w = boost::stoer_wagner_min_cut(g, get(boost::edge_weight, g), boost::max_priority_queue(pq)); BOOST_CHECK_EQUAL(w, 3407);