Boost logo

Boost Users :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-03-30 07:38:24


Peter Aronsson wrote:

> Hi. I am having a problem with depth_first_search.
> The thing I do different is that I do not put any info in a property map
> and I do not want to bother myself with colormaps etc.
>
> The application code does:
>
> Graph g;
> pass2_visitor vis;
>
> depth_first_search(g,boost::visitor(vis));
>
> But I get a compilation error, saying that it can not find a suitable
> operator+ in the property_map...

Well, dfs need color map for its operation. You did not provide any, so it
tried to use default color map, using std::vector and vertex indices. But,
your graph also does not provide vertex_index_t property, so you get the
error.

When I use:
typedef boost::property<boost::vertex_name_t,string,
          boost::property<vertex_execcost_t,float,
           boost::property<vertex_unique_id_t, int,
            boost::property<boost::vertex_index_t, int>
>
>
> VertexProperty;

your example compiles. However, for your example to work, you also need to
manually iterate over all vertices and assign the vertex_index property.
That's not nice, but I don't know better way.

- Volodya


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