Boost logo

Boost Users :

From: Jack Rabbit (yg-boost-users_at_[hidden])
Date: 2003-03-13 05:03:47


Hi,

I'm trying to create a graph that has a name for each vertex. Below is
what I've come up with so far. I really don't know what's wrong with it.
Can any of you help me out? I'm using boost 1.29.0 with Visual
Studio6.0sp5 on win2k.

I'm getting some errors on the line that's supposed to get the property
map. Then a whole bunch of others because in the end 'name' has the
wrong type.

kind regards,
Dieter Vrancken

// create some vertex names
typedef std::set<std::string> StringSet;
StringSet v_names;
std::string names[] = { "v1", "v2", "v3" };
v_names.insert(names, names + sizeof(names)/sizeof(names[0]));

// declare the graph
typedef boost::adjacency_list<boost::setS, boost::vecS,
     boost::directedS, boost::vertex_name_t, boost::no_property,
     boost::graph_name_t, boost::setS> Graph;
Graph g(v_names.size());

// get the property map for the vertex names
boost::property_map<Graph, boost::vertex_name_t>::type name =
     boost::get(boost::vertex_name, g);
// fill in the names
StringSet::const_iterator ss_it = v_names.begin(),
                           ss_end = v_names.end();
int i = 0;
for(; ss_it!=ss_end; ++ss_it, ++i)
     boost::put(name, i, *ss_it);


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