Hi guys,
the boost graph library has an example on using bundled properties. I
would like to serialise the resulting graph into graphml. Using
dynamic_properties for the std::vector attribute fails to compile with
boost 1.41. Is there a way to get this example below to work? I would
greatly appreciate it.
Thanks,
Dominik
#include <vector>
#include <string>
#include
#include
struct City
{
std::string name;
int population;
std::vector<int> zipcodes;
};
struct Highway
{
std::string name;
double miles;
int speed_limit;
int lanes;
bool divided;
};
int main()
{
typedef boost::adjacency_list<
boost::listS, boost::vecS, boost::bidirectionalS,
City, Highway> Graph;
Graph g;
Graph::vertex_descriptor v = *vertices(g).first;
g[v].name = "Troy";
g[v].population = 49170;
g[v].zipcodes.push_back(12180);
Graph::edge_descriptor e = *out_edges(v, g).first;
g[e].name = "I-87";
g[e].miles = 10;
g[e].speed_limit = 65;
g[e].lanes = 4;
g[e].divided = true;
boost::dynamic_properties dp;
// dp.property("zip_codes", boost::get(&City::zipcodes, g));
dp.property("name", boost::get(&City::name, g));
return EXIT_SUCCESS;
}
--
Dominik Dahlem
-------------------------------------------------------
Trinity College Dublin
School of Computer Science and Statistics,
Dublin 2, Ireland
tel: (+353) 1-896 3789
fax: (+353) 1-677 2204
www: http://www.cs.tcd.ie/Dominik.Dahlem/
-------------------------------------------------------