Boost logo

Boost :

From: Andrew Sutton (asutton_at_[hidden])
Date: 2008-02-27 20:24:19


> as it seems I've found a bug in the depth_first_search algorithm.
> I want to use it with my own ColorMap and a start vertex. Here
> is the code taken from
> http://www.boost.org/libs/graph/example/dfs-example.cpp with
> some slight modifications:

It's a problem with the way you're calling the function. You're
calling...

> depth_first_search(g, visitor(vis), &color[0], root );

And getting...

> /usr/include/boost/graph/depth_first_search.hpp:197: error: 'struct
> boost::bgl_named_params<dfs_time_visitor<main::size_type*>,
> boost::graph_visitor_t, boost::no_property>' has no member named
> 'initialize_vertex'
> dfs.cc:76: instantiated from here

It looks like you're calling a function that takes a visitor type as
the 2nd parameter. The problem is that the visitor() function is
probably creating a bgl_named_parameters struct, not a visitor.
Needless to say, the named parameters structure doesn't have members
named initialize_vertex() or finish_vertex(), etc. Try chaining the
named parameters together like this:

visitor(vis).color_map(&color[0]).start_vertex(root)

> So, there seem to be a bug in the algorithm. When calling it as
> defined in the exampl file from the Boost side without a ColorMap
> and a vertex, it works fine.

Again, it's not really a bug in the algorithm... There's so much
genericism in the interface that it's easy to get lost in the
instantiations. This library is due for a serious overhaul.

Andrew Sutton
asutton_at_[hidden]


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk