
On 11/17/05, Stephane Grabli <Stephane.Grabli@imag.fr> wrote:
Hi,
I'm (still) trying to use the strong components algorithm with a graph storing vertices as a list (listS). I've learned thanks to this mailing list that I had to explicitely declare and intialize a vertex_index map. The declaration of my graph type should therefore look like that:
typedef adjacency_list<listS, listS, directedS,property<vertex_index_t,std::size_t> > Graph;
and the component map should be declared this way: typedef graph_traits<Graph>::vertices_size_type v_size_t; //the range of ComponentMap vector_property_map< v_size_t, property_map<Graph, vertex_index_t>::type> componentMap(num_vertices(g), get(vertex_index,g) ); //g is an instance of Graph
I would like to know if there is a way to combine this with the use of bundles. In practice, I used to have this declaration for my graph type:
typedef adjacency_list<listS, listS, directedS,VertexBundle> Graph;
with: struct VertexBundle{ int id; };
How should I merge these two types of declarations? Is there a way to define the required vertex_index as a bundle property and to use it to define my component map afterward? Thanks!
Yes, there is a way... see my answer to your previous thread on the same subject... With your example: strong_components ("your previous arguments", vertex_index_map (get (&VertexBundle::id, g))) So the algorithm strong_components uses your property id as a map<vertex, index> for its vertex_index_map and not its default argument (get(vertex_index, g)), which doesn't exist for your container (listS). -- Johan