Boost logo

Boost Users :

From: Doug Gregor (dgregor_at_[hidden])
Date: 2005-07-22 13:55:10


On Jul 13, 2005, at 9:01 AM, sr kumar wrote:
> I am attempting use bundled properties for my graph processing.
> My attempt to 'write_graphviz' fails because of a lack of an
> vertex_index as an internal property.
>
> But how does one specify this? Named params do not seem to be
> an option. Being new to the template meta programming game,
> I am having some trouble figuring out how to make this work.

We've fixed write_graphviz so that it takes an (optional) index_map.
This change will be in the upcoming Boost 1.33.0.

> #include <boost/graph/adjacency_list.hpp>
> #include <boost/graph/topological_sort.hpp>
> #include <boost/graph/graphviz.hpp>
>
> using namespace boost;
> using namespace std;
>
> class A {
> public:
> // dummy class
> };
>
> typedef struct VertexProperties {
> A* a;
> std::size_t index;
> boost::default_color_type color;
> } VertexProperties;
>
> typedef struct EdgeProperties {
> A* a;
> } EdgeProperties;
>
>
>
> int main(void) {
>
> typedef adjacency_list<vecS, listS, directedS, VertexProperties,
> EdgeProperties> Graph;

If you need a quick fix (other than getting Boost from CVS), you can
actually mix bundled properties with non-bundled properties. For
instance, if you remove the "index" member from VertexProperties you
can then do this:

    typedef adjacency_list<vecS, listS, directedS,
property<vertex_index_t, std::size_t, VertexProperties>,
EdgeProperties> Graph;

I hope it helps!

        Doug


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