Boost logo

Boost Users :

Subject: [Boost-users] [BGL] Using a default-constructed property map for storing temporary vertex properties
From: Daniel Trebbien (dtrebbien_at_[hidden])
Date: 2010-06-17 12:40:14


Hello all,

I am currently working on a generic implementation of the Stoer–Wagner
min-cut algorithm using BGL. Crucial to the algorithm is the merging
of a vertex s into a vertex t after each phase, creating a new view of
the input graph, the merged graph, denoted G/{s, t}. Rather than
create a new graph that represents the merged graph, I figured that I
could use a vertex property that would be the vertex that each vertex
is assigned to at the start of each phase.

One of the template parameters of my implementation is the property
map type of the "assignment" property map. It is the last template
parameter, as it's not as important to the algorithm as others, but I
wanted the user to be able to provide the assignment property map type
if s/he wanted, otherwise, the implementation would use a "default"
property map type and default-constructed instance of the default
assignment property map type.

I tried `boost::associative_property_map<std::map<vertex_descriptor,
vertex_descriptor> >`, which can be default-constructed, but the first
time that I call `boost::get` or `boost::put` on the property map
object, I get a SEGFAULT. Apparently, the default construction of
`boost::associative_property_map<std::map<vertex_descriptor,
vertex_descriptor> >` did not default-construct a
`std::map<vertex_descriptor, vertex_descriptor>` object for use in
storing the vertex property values.

Is there some other property map type that I can use for this purpose?

Daniel


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net