Boost logo

Boost :

From: Rob Smallshire (robert_at_[hidden])
Date: 2001-07-24 10:23:26


I have two questions regarding the connected_components() algorithm
in the BGL when using MSVC6.0sp5

~~~~~~~~~~~~~~

Q1. First of all using an external property map to store the
component number for each vertex...

std::vector<int> component(boost::num_vertices(G));
int num = boost::connected_components(G, &component[0]);

The code above, which is copied almost verbatim from
boost/graph/connected_components.hpp into my program

gives the following error message:

C:/users/rob/dev/utils/boost/boost_1_22_0\boost/property_map.hpp
(185) : error C2664: 'void __cdecl boost::put(int *,int,
const int &)' : cannot convert parameter 2 from 'void *' to 'int'
This conversion requires a reinterpret_cast, a C-style cast or
function-style cast C:/users/rob/dev/utils/boost/boost_1_22_0
\boost/property_map.hpp(183) : while compiling class-template member
function 'void __thiscall boost::WritablePropertyMapConcept<int
*,void *>::constraints(void)'

Any suggestions as to why this is so would be useful.

~~~~~~~~~~~~~~

Q2. Rather than using an arbitrary combination of internal and
external property maps for my graph I'd like to be consistent and use
internal property maps. I have created a new property for the
component number :

struct component_t
{
   enum { num = 4564 };
   typedef boost::vertex_property_tag kind;
};

typedef boost::property<component_t, int, VertexSetProperty>
VertexComponentProperty;

...

typedef boost::property_map<Graph, component_t>::type
ComponentPropertyMap;

and later in the code I get a property map object using:

ComponentPropertyMap component = boost::get(component_t(), G);

I then want to write something like:

int num = boost::connected_components(G, component);

but I can't seem to get the syntax right. Is it possible to use an
internal property map in this way ?

Thanks in advance for any help with either of these questions.

Rob Smallshire


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk