Boost logo

Boost Users :

Subject: [Boost-users] [Boost][BGL] Dynamic Property, dynamic_get_failure.
From: Mathieu - (ptr.jetable_at_[hidden])
Date: 2011-04-26 17:42:28


I'm trying to generate random graphs (with random edge weight) and
write them to a dot file, but
I get this exception in the write_graphviz_dp() function :
"what(): dynamic property get cannot retrieve value for property: weight."

The code looks like this :

    typedef boost::adjacency_list<boost::vecS, boost::vecS,
boost::directedS, property<edge_index_t, int>,
                                      property<edge_weight_t, int> > graph;

    boost::minstd_rand gen;

    graph g;
    boost::generate_random_graph(g, 10, 30, gen, false, false);
    boost::randomize_property<boost::edge_weight_t>(g, gen);

    dynamic_properties dp;"weight", get(edge_weight, g));

    boost::write_graphviz_dp(std::cout, g, dp, std::string("weight"));

(don't pay attention to the random generator it's just to keep it simple).

I've been looking at the examples and at the doc and it doesn't seem
to me that I'm doing something wrong... but apparently I am.

Thanks in advance!.

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at