Boost logo

Boost Users :

Subject: Re: [Boost-users] [Boost.Graph]: read_graphviz into std::vector
From: Ronald Garcia (garcia_at_[hidden])
Date: 2009-06-10 13:16:04


Hi Sascha,

Here is a small example program I wrote that seems to do what you
want. The main difference is that it "gets" the property map
and places it in the dynamic properties at the same time:

#include <boost/graph/adjacency_list.hpp>
#include <boost/property_map/dynamic_property_map.hpp>

using namespace boost;

struct vertex_p {
   int foo;
   char bar;
};

int main() {

   typedef adjacency_list<vecS,vecS, directedS, vertex_p> graph_t;

   graph_t g;

   dynamic_properties dp;

   dp.property("foo",get(&vertex_p::foo,g));

}

HTH,
Ron

On Jun 5, 2009, at 1:09 PM, Sascha Winter wrote:

> Hi,
>
> I have graphes in the .dot format, with 24 vertex labels d1-d24,
> each storing one double.
> I want to use
> struct Vertex_p
>
> {
> std::string node_id;
> std::vector<double> d;
> }
>
> as the bundled property for my graph in boost and use read_graphviz
> to load the graph. How do I have to construct the property_map and
> the dynamic_properties?
> This
>
> property_map<graph_t, vector<double> Vertex_p::*>::type g_d =
> get(&Vertex_p::d, graph);
> g_dp.property("d",g_d);
>
> does not work. Is it even possible to do something like this?
>
> Thanks for any help,
> Sascha
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


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