|
Boost Users : |
Subject: Re: [Boost-users] Boost-users Digest, Vol 2928, Issue 3
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2011-12-07 15:31:28
On Wed, 7 Dec 2011, Nicolas Saunier wrote:
> Hi,
>
> On 11-12-07 02:21 PM, boost-users-request_at_[hidden] wrote:
>> Message: 6
>> Date: Wed, 7 Dec 2011 14:19:46 -0500 (EST)
>> From: Jeremiah Willcock<jewillco_at_[hidden]>
>> To:boost-users_at_[hidden]
>> Subject: Re: [Boost-users] [BGL] Issue using connected_components
>> Message-ID:<alpine.LRH.2.00.1112071418120.25335_at_[hidden]>
>> 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<FeatureGraph, vertex_index_t>::const_type
>
components(num_vertices(g), get(vertex_index, g));
This requires a vecS vertex container, though.
-- Jeremiah Willcock
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