Boost logo

Boost Users :

Subject: [Boost-users] boost::graph - Newbie question about vertex properties
From: Stephen Karmann (icboostuser_at_[hidden])
Date: 2009-11-10 11:13:04


Hello dear mailing list members,

i'm new to this mailing list and hope i'm right here and that my english is not
too annoying.

I have to to some distance calculation and decided to use the
boost::graph-framework to do this as i have to develop a C++ application using
Visual C++ Express Edition 2008. I have to include some background details
information in the vertices and edges of my graph and chose to append such meta
info objects to the vertices and edges with the help of properties. I defined
the following types in the Header-Class:

[code]
        struct vtx_ref_t {
                typedef boost::vertex_property_tag kind;
        };
        struct edge_ref_t {
                typedef boost::edge_property_tag kind;
        };

        // VtxMetaClass and EdgeMetaClass are some Classes containing some
        // infos needed for calculation
        typedef boost::property<vtx_ref_t, VtxMetaClass*> VtxProperty;
        typedef boost::property<edge_ref_t, EdgeMetaClass*> EdgeProperty;
        typedef boost::adjacency_list<boost::vecS, boost::vecS,
        boost::directedS, VtxProperty, EdgeProperty> MyGraphType;

        typedef boost::graph_traits<MyGraphType>::vertex_descriptor vertex_t;
        typedef boost::graph_traits<MyGraphType>::edge_descriptor edge_t;
[/code]

In the Main-Method i tried to use the function boost::put to append such a meta
class object infoobj to a vertex (whose vertex descriptor vtx i only have) i
have created somewhere else where i cannot append the infoobject cause i don't
know at that time which one to append.

[code]
        MyGraphType graph(100);
        vertex_t vtx = boost::add_vertex(graph);
        VtxMetaClass* infoobj;
        ...
        boost::property_map<MyGraphType, vtx_ref_t>::type vtxref =
        get(vtx_ref_t(), graph);
        boost::put(vtxref, graph, vtx, infoobj);
[/code]

But i only get a compilation error telling me that:
1>e:\development\VC++\project\include\boost/pending/property.hpp(46) : error
C2039: 'kind': is no element of
'boost::vec_adj_list_vertex_property_map<Graph,GraphPtr,ValueType,Reference,Tag>'

What is wrong with that, i did what was suggested in the online manual ?

I know there's also the possibility to use boost::put with the index of the
vertex that has to be manipulated, but i don't know how to query the index from
the vertex_descriptor i have, perhaps you came across a way to do this yet ...

Perhaps you could help me with this problem ?
Thank you very much in anticipation,
Stephen


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