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


Hi,

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
'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector&lt;boost::dynamic_const_put_error>
>'
  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,
EdgeWeightProperty>
                undirected_graph;
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");
        in.close();
        return g;
}

int main() {
        boost::dynamic_properties dp;
        // populate graph properties by reference
        undirected_graph g = read_graph("test_boost_graph.dot", &dp);

        dp.property("node_id", get(vertex_index, g));
        dp.property("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: http://boost.2283326.n4.nabble.com/Properties-error-reading-undirected-graph-with-read-graphviz-tp4265090p4265090.html
Sent from the Boost - Users mailing list archive at Nabble.com.

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