Boost logo

Boost Users :

From: Grégoire Dooms (dooms_at_[hidden])
Date: 2005-11-15 14:10:51


Stephane Grabli wrote:

>Hi,
>
>I'm new to the BGL and I'm trying to use the strong_components
>algorithm, defined this way:
>
>template <class Graph, class ComponentMap, class P, class T, class R>
>typename property_traits<ComponentMap>::value_type
>strong_components(Graph& g, ComponentMap comp,
> const bgl_named_params<P, T, R>& params = all defaults)
>
>with a graph
>defined like this:
>
>typedef adjacency_list<listS,listS,directedS> Graph;
>
>(in particular using listS for vertices storage).
>
>Does anyone know how I should declare the ComponentMap property map?
>I couldn't figure this out from the documentation and the examples I've
>seen all assume that a vecS type storage is used for vertices in the graph.
>Thanks!
>
>
>
you could use this:
        typedef
std::map<Graph::vertex_descriptor,Graph::vertices_size_type> CN;
        CN v2comp;
        associative_property_map<CN> compmap(v2comp);

HTH,

--
Grégoire Dooms

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