Boost logo

Boost Users :

Subject: [Boost-users] Properties error reading undirected graph with "read_graphviz"
From: nunofaria (nunofaria11_at_[hidden])
Date: 2012-01-05 06:22:02


I am trying to read an undirected_graph from a .dot file with read_graphviz,
but I seem to some problems regarding the properties of the graph, which are
*vertex_index* and *edge_weight*.

/terminate called after throwing an instance of
  what(): Attempt to put a value into a const property map: /

The code I am using is followed:

*typedef property<edge_weight_t, int> EdgeWeightProperty;
typedef adjacency_list<vecS, vecS, undirectedS, no_property,
typedef property_map<undirected_graph, edge_weight_t>::type weight_map_type;
typedef property_traits<weight_map_type>::value_type weight_type;
typedef std::pair<int, int> edge_t;

undirected_graph read_graph(std::string filename, dynamic_properties * dp) {
        std::ifstream in(filename.c_str());
        // ... check errors in file ...
        undirected_graph g(0);
        read_graphviz(in, g, *dp, "node_id");
        return g;

int main() {
        boost::dynamic_properties dp;
        // populate graph properties by reference
        undirected_graph g = read_graph("", &dp);"node_id", get(vertex_index, g));"w", get(edge_weight, g));
        // write to cout
        write_graphviz_dp(cout, g, dp, "node_id");
        return 0;

I think the example is pretty simple and it should work. However I don't get
much when googling the resulting error.
Does someone know what's this about?

Thanks in advance

View this message in context:
Sent from the Boost - Users mailing list archive at

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