
On Wed, 7 Dec 2011, Nicolas Saunier wrote:
Hi,
On 11-12-07 02:21 PM, boost-users-request@lists.boost.org wrote:
Message: 6 Date: Wed, 7 Dec 2011 14:19:46 -0500 (EST) From: Jeremiah Willcock
To:boost-users@lists.boost.org Subject: Re: [Boost-users] [BGL] Issue using connected_components Message-ID: Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed On Wed, 7 Dec 2011, Nicolas Saunier wrote:
Hi,
here is a simplified code sample that I cannot get to work. I use bundled properties for an undirected graph and I do not find what should be the type of the component map (or property map) that should be passed as the second argument of the connected_components function. The sample is useless since only integers are for vertices. The normal vector_property_map class does not work for adjacency_list graphs with a listS vertex container unless you define a vertex_index_map. Is there a reason you can't use vecS as the vertex container in your graph? If you truly need listS, you will need to create a vertex index map, fill it in before you create the property map, and pass it to the vector_property_map constructor (and as a type argument to that class).
-- Jeremiah Willcock
Thanks for replying. The problem, and that may seem too simple or silly to people familiar with the library, is that I have no idea what should be the type of the component map to pass. I tried to declare the components variable as:
vector< graph_traits<FeatureGraph>::vertices_size_type > components(num_vertices(g));
And it does not work either. What is the type of the component map, the second argument of connected_components? Can you give me an example of a type that would work (compile and return the correct results)?
Try:
shared_array_property_map<
...::vertices_size_type,
property_map
components(num_vertices(g), get(vertex_index, g)); This requires a vecS vertex container, though. -- Jeremiah Willcock