[graph] reading GraphML

I'm trying to write a testcase for graphml.hpp/.cpp from graph-tool. I have the following: #include <boost/graph/adjacency_list.hpp> #include <boost/property_map.hpp> #include <boost/dynamic_property_map.hpp> #include <iostream> #include <boost/graph/graph_traits.hpp> #include <map> #include "./graphml.hpp" enum edge_length_t { edge_length }; namespace boost { BOOST_INSTALL_PROPERTY(edge, length); } int main(int argc, char* argv[]){ // create a typedef for the Graph type using namespace boost; typedef boost::adjacency_list<vecS, vecS, bidirectionalS, no_property, property<edge_length_t, double> > Graph; Graph g; std::ifstream input(argv[1]); boost::dynamic_properties properties; typedef graph_traits<Graph>::vertex_descriptor vertex_descriptor; std::map<vertex_descriptor, double> coord1; boost::associative_property_map< std::map<vertex_descriptor, double> > coord1_map(coord1); properties.property("coord1", coord1_map); std::map<vertex_descriptor, double> coord2; boost::associative_property_map< std::map<vertex_descriptor, double> > coord2_map(coord2); properties.property("coord2", coord2_map); // typedef graph_traits<Graph>::edge_descriptor edge_descriptor; properties.property("length", get(edge_length, g)); boost::read_graphml(input, g, properties); } It runs fine, but when I compile it, I get the following warning: /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/include/g++-v4/ext/new_allocator.h: In member function 'std::pair<boost::any, bool> boost::mutate_graph_impl<MutableGraph>::do_add_edge(boost::any, boost::any) [with MutableGraph = boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS, boost::no_property, boost::property<edge_length_t, double, boost::no_property>, boost::no_property, boost::listS>]': /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/include/g++-v4/ext/new_allocator.h:106: warning: 'p$m_value' is used uninitialized in this function I suppose this is nothing bad? Is there a good way to use a "dummy map" which does not store anything? Any comments on the code are highly appreciated ...

Hi Jens, 2006/10/10, Jens Müller <jens.mueller@ira.uka.de>: [bigsnip]
Is there a good way to use a "dummy map" which does not store anything?
There's a dummy_property_map defined in boost/property_map.hpp (http://tinyurl.com/nefnk) It's widely used in the graph algorithms, but I haven't found any docs about it so far... Cheers, Stephan

I found the solution. Please do not post my message on the list. Thanks Olivier
participants (3)
-
Jens Müller
-
Olivier Tournaire
-
Stephan Diederich