Merged in more trunk bug fixes for Boost.Graph and Boost.PropertyMap

[SVN r78641]
This commit is contained in:
Jeremiah Willcock 2012-05-26 18:56:37 +00:00
parent 0b30767da0
commit cbe70511cd
33 changed files with 160 additions and 97 deletions

View File

@ -172,7 +172,9 @@ IN: <tt>weight_map(WeightMap w_map)</tt>
<a href="../../property_map/doc/ReadablePropertyMap.html">Readable Property Map</a>. 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
<i>Addable</i> with the value type of the distance map.<br>
the same as the value type of the distance map, and that type must be <a
href="http://www.sgi.com/tech/stl/LessThanComparable.html">Less Than
Comparable</a>.<br>
<b>Default:</b> <tt>get(edge_weight, g)</tt><br>
<b>Python</b>: Must be an <tt>edge_double_map</tt> for the graph.<br>
<b>Python default</b>: <tt>graph.get_edge_double_map("weight")</tt>
@ -190,7 +192,7 @@ IN: <tt>vertex_index_map(VertexIndexMap i_map)</tt>
<b>Default:</b> <tt>get(vertex_index, g)</tt>
Note: if you use this default, make sure your graph has
an internal <tt>vertex_index</tt> property. For example,
<tt>adjacenty_list</tt> with <tt>VertexList=listS</tt> does
<tt>adjacency_list</tt> with <tt>VertexList=listS</tt> does
not have an internal <tt>vertex_index</tt> property.
<br>
<b>Python</b>: Unsupported parameter.
@ -204,10 +206,9 @@ UTIL/OUT: <tt>distance_map(DistanceMap d_map)</tt>
The type <tt>DistanceMap</tt> must be a model of <a
href="../../property_map/doc/ReadWritePropertyMap.html">Read/Write
Property Map</a>. 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 <a
href="http://www.sgi.com/tech/stl/LessThanComparable.html">Less Than
Comparable</a>.<br>
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 <tt>weight_map</tt>
argument.<br>
<b>Default:</b> <a href="../../property_map/doc/iterator_property_map.html">
<tt>iterator_property_map</tt></a> created from a
<tt>std::vector</tt> of the <tt>WeightMap</tt>'s value type of size

View File

@ -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 ;

View File

@ -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))

View File

@ -46,22 +46,23 @@ int main(int, char*[])
using namespace boost;
const char* name = "abcdefghij";
GraphvizDigraph G;
read_graphviz("scc.dot", G);
adjacency_list<vecS, vecS, directedS> 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<GraphvizGraph>::vertex_descriptor Vertex;
typedef graph_traits<adjacency_list<vecS, vecS, directedS> >::vertex_descriptor Vertex;
std::vector<int> component(num_vertices(G)), discover_time(num_vertices(G));
std::vector<default_color_type> color(num_vertices(G));
std::vector<Vertex> 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<int>::size_type i;

View File

@ -502,20 +502,20 @@ namespace boost {
#define ADJLIST adjacency_list<OEL,VL,D,VP,EP,GP,EL>
template<ADJLIST_PARAMS, typename Tag, typename Value>
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<ADJLIST_PARAMS, typename Tag>
inline typename graph_property<ADJLIST, Tag>::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<ADJLIST_PARAMS, typename Tag>
inline typename graph_property<ADJLIST, Tag>::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.

View File

@ -270,7 +270,6 @@ bron_kerbosch_all_cliques(const Graph& g, Visitor vis, std::size_t min)
{
BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<Graph> ));
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
BOOST_CONCEPT_ASSERT(( VertexIndexGraphConcept<Graph> ));
BOOST_CONCEPT_ASSERT(( AdjacencyMatrixConcept<Graph> )); // Structural requirement only
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
typedef typename graph_traits<Graph>::vertex_iterator VertexIterator;

View File

@ -13,7 +13,6 @@
#include <list>
#include <stack>
#include <boost/config.hpp>
#include <boost/utility.hpp> //for next and prior
#include <boost/graph/graph_traits.hpp>
#include <boost/property_map/property_map.hpp>

View File

@ -7,7 +7,7 @@
#ifndef BOOST_GRAPH_CLUSTERING_COEFFICIENT_HPP
#define BOOST_GRAPH_CLUSTERING_COEFFICIENT_HPP
#include <boost/utility.hpp>
#include <boost/next_prior.hpp>
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/graph_concepts.hpp>
#include <boost/graph/lookup_edge.hpp>

View File

@ -41,7 +41,7 @@
#include <boost/graph/properties.hpp>
#include <boost/static_assert.hpp>
#include <boost/functional/hash.hpp>
#include <boost/utility.hpp>
#include <boost/next_prior.hpp>
#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<BOOST_CSR_GRAPH_TEMPLATE_PARMS, class Tag, class Value>
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<BOOST_CSR_GRAPH_TEMPLATE_PARMS, class Tag>
inline
typename graph_property<BOOST_CSR_GRAPH_TYPE, Tag>::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<BOOST_CSR_GRAPH_TEMPLATE_PARMS, class Tag>
inline
const
typename graph_property<BOOST_CSR_GRAPH_TYPE, Tag>::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<BOOST_CSR_GRAPH_TEMPLATE_PARMS>

View File

@ -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<graph_type&>(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

View File

@ -44,7 +44,6 @@
#include <boost/graph/graph_selectors.hpp>
#include <boost/static_assert.hpp>
#include <boost/functional/hash.hpp>
#include <boost/utility.hpp>
namespace boost {

View File

@ -7,7 +7,6 @@
#ifndef BOOST_GRAPH_DIRECTED_GRAPH_HPP
#define BOOST_GRAPH_DIRECTED_GRAPH_HPP
#include <boost/utility.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/properties.hpp>

View File

@ -7,7 +7,7 @@
#ifndef BOOST_GRAPH_ECCENTRICITY_HPP
#define BOOST_GRAPH_ECCENTRICITY_HPP
#include <boost/utility.hpp>
#include <boost/next_prior.hpp>
#include <boost/config.hpp>
#include <boost/graph/detail/geodesic.hpp>
#include <boost/concept/assert.hpp>

View File

@ -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 <typename V, typename D, typename P, typename B>
V source(const typename incidence_graph_archetype<V,D,P,B>::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 <typename V, typename D, typename P, typename B>
@ -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 <typename V, typename D, typename P, typename B>

View File

@ -325,10 +325,10 @@ namespace boost {
template <typename PropVal, typename PropertyTag>
void test_readable_vertex_property_graph
(const std::vector<PropVal>& vertex_prop, PropertyTag, const Graph& g)
(const std::vector<PropVal>& vertex_prop, PropertyTag tag, const Graph& g)
{
typedef typename property_map<Graph, PropertyTag>::const_type const_Map;
const_Map pmap = get(PropertyTag(), g);
const_Map pmap = get(tag, g);
typename std::vector<PropVal>::const_iterator i = vertex_prop.begin();
for (typename boost::graph_traits<Graph>::vertex_iterator
@ -339,7 +339,7 @@ namespace boost {
++bgl_first_9) {
//BGL_FORALL_VERTICES_T(v, g, Graph) {
typename property_traits<const_Map>::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<PropVal>& vertex_prop, PropertyTag tag, Graph& g)
{
typedef typename property_map<Graph, PropertyTag>::type PMap;
PMap pmap = get(PropertyTag(), g);
PMap pmap = get(tag, g);
typename std::vector<PropVal>::const_iterator i = vertex_prop.begin();
for (typename boost::graph_traits<Graph>::vertex_iterator
bgl_first_9 = vertices(g).first, bgl_last_9 = vertices(g).second;
@ -368,7 +368,7 @@ namespace boost {
typename std::vector<PropVal>::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);
}

View File

@ -29,6 +29,7 @@
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/xpressive/xpressive_static.hpp>
#include <boost/foreach.hpp>
namespace boost {

View File

@ -9,7 +9,6 @@
#define __IS_KURATOWSKI_SUBGRAPH_HPP__
#include <boost/config.hpp>
#include <boost/utility.hpp> //for next/prior
#include <boost/tuple/tuple.hpp> //for tie
#include <boost/property_map/property_map.hpp>
#include <boost/graph/properties.hpp>
@ -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);
}

View File

@ -9,7 +9,7 @@
#define __IS_STRAIGHT_LINE_DRAWING_HPP__
#include <boost/config.hpp>
#include <boost/utility.hpp> //for next and prior
#include <boost/next_prior.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/tuple/tuple_comparison.hpp>
#include <boost/property_map/property_map.hpp>

View File

@ -11,9 +11,9 @@
#include <iterator>
#include <algorithm>
#include <boost/config.hpp>
#include <boost/assert.hpp>
#include <boost/smart_ptr.hpp>
#include <boost/graph/depth_first_search.hpp>
#include <boost/utility.hpp>
#include <boost/detail/algorithm.hpp>
#include <boost/pending/indirect_cmp.hpp> // for make_indirect_pmap
#include <boost/concept/assert.hpp>
@ -135,6 +135,10 @@ namespace boost {
bool test_isomorphism()
{
// reset isomapping
BGL_FORALL_VERTICES_T(v, G1, Graph1)
f[v] = graph_traits<Graph2>::null_vertex();
{
std::vector<invar1_value> 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
}
}
}
}

View File

@ -9,7 +9,7 @@
#define __MAKE_CONNECTED_HPP__
#include <boost/config.hpp>
#include <boost/utility.hpp> //for next
#include <boost/next_prior.hpp>
#include <boost/tuple/tuple.hpp> //for tie
#include <boost/graph/connected_components.hpp>
#include <boost/property_map/property_map.hpp>

View File

@ -14,7 +14,7 @@
#include <utility>
#include <boost/config.hpp>
#include <boost/operators.hpp>
#include <boost/int_iterator.hpp>
#include <boost/pending/detail/int_iterator.hpp>
#include <boost/graph/graph_traits.hpp>
namespace boost {

View File

@ -16,7 +16,6 @@
#include <algorithm> // for std::sort and std::stable_sort
#include <utility> // for std::pair
#include <boost/property_map/property_map.hpp>
#include <boost/utility.hpp> // for boost::tie
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/visitors.hpp>
#include <boost/graph/depth_first_search.hpp>

View File

@ -15,9 +15,8 @@
#include <boost/ref.hpp>
#include <boost/parameter/name.hpp>
#include <boost/parameter/binding.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits.hpp>
#include <boost/mpl/not.hpp>
#include <boost/type_traits/add_reference.hpp>
#include <boost/graph/properties.hpp>
#include <boost/graph/detail/d_ary_heap.hpp>
#include <boost/property_map/property_map.hpp>
@ -609,6 +608,13 @@ BOOST_BGL_DECLARE_NAMED_PARAMS
make_priority_queue_from_arg_pack_gen(KeyT defaultKey_) : defaultKey(defaultKey_) { }
template <class F>
struct result {
typedef typename remove_const<typename remove_reference<typename function_traits<F>::arg1_type>::type>::type graph_type;
typedef typename remove_const<typename remove_reference<typename function_traits<F>::arg2_type>::type>::type arg_pack_type;
typedef typename priority_queue_maker<graph_type, arg_pack_type, KeyT, ValueT, PriorityQueueTag, KeyMapTag, IndexInHeapMapTag, Compare>::priority_queue_type type;
};
template <class Graph, class ArgPack>
typename priority_queue_maker<Graph, ArgPack, KeyT, ValueT, PriorityQueueTag, KeyMapTag, IndexInHeapMapTag, Compare>::priority_queue_type
operator()(const Graph& g, const ArgPack& ap) const {

View File

@ -12,7 +12,7 @@
#include <vector>
#include <list>
#include <boost/config.hpp>
#include <boost/utility.hpp> //for next and prior
#include <boost/next_prior.hpp>
#include <boost/graph/graph_traits.hpp>
#include <boost/property_map/property_map.hpp>

View File

@ -10,7 +10,7 @@
#include <vector>
#include <list>
#include <boost/utility.hpp> //for boost::next
#include <boost/next_prior.hpp>
#include <boost/config.hpp> //for std::min macros
#include <boost/shared_ptr.hpp>
#include <boost/tuple/tuple.hpp>

View File

@ -10,8 +10,11 @@
#define __PLANAR_FACE_TRAVERSAL_HPP__
#include <vector>
#include <boost/utility.hpp> //for next and prior
#include <set>
#include <map>
#include <boost/next_prior.hpp>
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/properties.hpp>
namespace boost

View File

@ -105,6 +105,7 @@ class reverse_graph {
typedef graph_traits<BidirectionalGraph> 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<reverse_graph_tag> {
};
template <class BidirGraph, class GRef, class Property>
typename property_map<reverse_graph<BidirGraph,GRef>, Property>::type
typename disable_if<
is_same<Property, edge_underlying_t>,
typename property_map<reverse_graph<BidirGraph,GRef>, Property>::type>::type
get(Property p, reverse_graph<BidirGraph,GRef>& g)
{
return typename property_map<reverse_graph<BidirGraph,GRef>, Property>::type(get(p, g.m_g));
}
template <class BidirGraph, class GRef, class Property>
typename property_map<reverse_graph<BidirGraph,GRef>, Property>::const_type
typename disable_if<
is_same<Property, edge_underlying_t>,
typename property_map<reverse_graph<BidirGraph,GRef>, Property>::const_type>::type
get(Property p, const reverse_graph<BidirGraph,GRef>& g)
{
const BidirGraph& gref = g.m_g; // in case GRef is non-const
@ -406,9 +411,11 @@ get(Property p, const reverse_graph<BidirGraph,GRef>& g)
}
template <class BidirectionalGraph, class GRef, class Property, class Key>
typename property_traits<
typename property_map<BidirectionalGraph, Property>::const_type
>::value_type
typename disable_if<
is_same<Property, edge_underlying_t>,
typename property_traits<
typename property_map<reverse_graph<BidirectionalGraph, GRef>, Property>::const_type
>::value_type>::type
get(Property p, const reverse_graph<BidirectionalGraph,GRef>& g, const Key& k)
{
return get(get(p, g), k);
@ -459,19 +466,40 @@ struct property_map<reverse_graph<Graph, GRef>, edge_underlying_t> {
typedef detail::underlying_edge_desc_map_type<ed> const_type;
};
template <class Graph, class GRef>
detail::underlying_edge_desc_map_type<typename graph_traits<Graph>::edge_descriptor>
template <typename T> struct is_reverse_graph: boost::mpl::false_ {};
template <typename G, typename R> struct is_reverse_graph<reverse_graph<G, R> >: boost::mpl::true_ {};
template <class G>
typename enable_if<is_reverse_graph<G>,
detail::underlying_edge_desc_map_type<typename graph_traits<typename G::base_type>::edge_descriptor> >::type
get(edge_underlying_t,
const reverse_graph<Graph,GRef>& g)
G& g)
{
return detail::underlying_edge_desc_map_type<typename graph_traits<Graph>::edge_descriptor>();
return detail::underlying_edge_desc_map_type<typename graph_traits<typename G::base_type>::edge_descriptor>();
}
template <class Graph, class GRef>
typename graph_traits<Graph>::edge_descriptor
template <class G>
typename enable_if<is_reverse_graph<G>, typename graph_traits<typename G::base_type>::edge_descriptor>::type
get(edge_underlying_t,
const reverse_graph<Graph,GRef>& g,
const typename graph_traits<reverse_graph<Graph, GRef> >::edge_descriptor& k)
G& g,
const typename graph_traits<G>::edge_descriptor& k)
{
return k.underlying_descx;
}
template <class G>
typename enable_if<is_reverse_graph<G>, detail::underlying_edge_desc_map_type<typename graph_traits<typename G::base_type>::edge_descriptor> >::type
get(edge_underlying_t,
const G& g)
{
return detail::underlying_edge_desc_map_type<typename graph_traits<typename G::base_type>::edge_descriptor>();
}
template <class G>
typename enable_if<is_reverse_graph<G>, typename graph_traits<typename G::base_type>::edge_descriptor>::type
get(edge_underlying_t,
const G& g,
const typename graph_traits<G>::edge_descriptor& k)
{
return k.underlying_descx;
}

View File

@ -318,13 +318,15 @@ namespace boost {
class sgb_vertex_util_map
: public boost::put_get_helper<Ref, sgb_vertex_util_map<Tag, Ref> >
{
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<Ref, sgb_edge_util_map<Tag, Ref> >
{
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);
}
};

View File

@ -20,7 +20,7 @@
#include <boost/graph/detail/d_ary_heap.hpp>
#include <boost/property_map/property_map.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/typeof/typeof.hpp>
#include <boost/utility/result_of.hpp>
namespace boost {
@ -218,7 +218,9 @@ namespace boost {
typedef boost::bgl_named_params<P, T, R> params_type;
BOOST_GRAPH_DECLARE_CONVERTED_PARAMETERS(params_type, params)
BOOST_AUTO(pq, (boost::detail::make_priority_queue_from_arg_pack_gen<boost::graph::keywords::tag::max_priority_queue, weight_type, vertex_descriptor, std::greater<weight_type> >(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<boost::graph::keywords::tag::max_priority_queue, weight_type, vertex_descriptor, std::greater<weight_type> > gen_type;
gen_type gen(choose_param(get_param(params, boost::distance_zero_t()), weight_type(0)));
typename boost::result_of<gen_type(const UndirectedGraph&, const arg_pack_type&)>::type pq = gen(g, arg_pack);
return boost::detail::stoer_wagner_min_cut(g,
weights,

View File

@ -24,7 +24,9 @@
#include <boost/static_assert.hpp>
#include <boost/assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/or.hpp>
namespace boost {
@ -778,7 +780,10 @@ class subgraph_global_property_map
{
typedef property_traits<PropertyMap> Traits;
public:
typedef typename Traits::category category;
typedef typename mpl::if_<is_const<typename remove_pointer<GraphPtr>::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<PropertyMap> Traits;
public:
typedef typename Traits::category category;
typedef typename mpl::if_<is_const<typename remove_pointer<GraphPtr>::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;

View File

@ -7,7 +7,6 @@
#ifndef BOOST_GRAPH_UNDIRECTED_GRAPH_HPP
#define BOOST_GRAPH_UNDIRECTED_GRAPH_HPP
#include <boost/utility.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/properties.hpp>

View File

@ -79,6 +79,7 @@ namespace boost {
typedef typename std::vector<EdgeList>::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 <class EdgeList>
struct edge_property_type< std::vector<EdgeList> >

View File

@ -206,10 +206,12 @@ BOOST_AUTO_TEST_CASE(test_prgen_20_70_2)
boost::associative_property_map<std::map<vertex_descriptor, std::size_t> > 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<weight_type, boost::property_map<undirected_graph, boost::vertex_index_t>::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<vertex_descriptor>::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<vertex_descriptor, 22, BOOST_TYPEOF(indicesInHeap), BOOST_TYPEOF(distances), std::greater<weight_type> > pq(distances, indicesInHeap);
typedef boost::shared_array_property_map<index_in_heap_type, boost::property_map<undirected_graph, boost::vertex_index_t>::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<vertex_descriptor, 22, indicesInHeap_type, distances_type, std::greater<weight_type> > 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);