From adjacency_list.html: "If the VertexList of the graph is vecS, then the graph has a builtin vertex indices accessed via the property map for the vertex_index_t
On Wed, 21 Nov 2001 cristipp@ics.uci.edu wrote:
cristi> Thanks. I added the vertex_color property to my graph and it works
cristi> just fine.
Great!
cristi> As a BGL (and not BCG :-)) novice I would like to
cristi> understand why the breadth_first_search compiles for
cristi> boost::adjacency_list with VertexType vecS, but not for
cristi> boost::adjacency_list with VertexType listS (unless the
cristi> colormap is passed as a parameter). Is there any piece of
cristi> documentation I should have read and I did not? Or could
cristi> anybody explain this for us, the big herd of users?
Sure.
Take a look at the docs in breadth_first_search.html, specifically the
color_map named parameter. As with most named parameters, you can
either pass in an argument, or use the default. The default in
this case is:
"Default: an iterator_property_map created from a std::vector of
default_color_type of size num_vertices(g) and using the i_map for the
index map."
where i_map is the vertex index map given as another named paremeter:
"IN: vertex_index_map(VertexIndexMap i_map)
This maps each vertex to an integer in the range [0, num_vertices(g)).
This parameter is only necessary when the default color property map is
used. The type VertexIndexMap must be a model of Readable Property Map.
The value type of the map must be an integer type. The vertex
descriptor type of the graph needs to be usable as the key type of the map.
Default: get(vertex_index, g)"
Now, an adjacency_list only has a builtin vertex index map if it
has VertexList=vecS:
property."
Alternatively, you could add a vertex index map to an adjacency_list with
VertexList=listS using a property